summaryrefslogtreecommitdiff
path: root/lib/oxidized/source/source.rb
diff options
context:
space:
mode:
authorSaku Ytti <saku@ytti.fi>2014-06-11 15:34:14 +0300
committerSaku Ytti <saku@ytti.fi>2014-06-11 15:34:14 +0300
commit6434e1a36caf025530363a16f52d77a5780ecc8a (patch)
treea68c5120605dbf63a8ab6ee57b8ff630f898c169 /lib/oxidized/source/source.rb
parent829654ad75d7329e5d9216899e019417f21d31d1 (diff)
Change dynamic discover of file => class name
We needed this, because use of 'def inherited' not idempotent, in Oxidized::Script use case we may need to restart Oxidized, even though it's already loaded, and we won't get class names populated via 'def inherited' anymore. There are quite many optiosn to do this a) filename == class name + no discovery/mapping, very clean - user 'source' must give us model name in exactly right capitalization b) add 'self' at end of files, so eval will return class name + deterministic with arbitrary name - DSL cruft, DSL being light is our main value (can we do this via parent class? I couldn't find way) c) load in new module via Module.module_eval X + module will contain only consts we just created - but which one is the one we want? - if we use eval, load errors won't tell line error But at least now we got rid of 'inherited' methods and not adding too much cruft, hope it's better than before.
Diffstat (limited to 'lib/oxidized/source/source.rb')
-rw-r--r--lib/oxidized/source/source.rb5
1 files changed, 0 insertions, 5 deletions
diff --git a/lib/oxidized/source/source.rb b/lib/oxidized/source/source.rb
index 5093950..3c1f255 100644
--- a/lib/oxidized/source/source.rb
+++ b/lib/oxidized/source/source.rb
@@ -1,11 +1,6 @@
module Oxidized
class Source
class NoConfig < OxidizedError; end
- class << self
- def inherited klass
- Oxidized.mgr.loader = { :class => klass }
- end
- end
def initialize
@map = (CFG.model_map or {})
end