diff options
author | Saku Ytti <saku@ytti.fi> | 2014-06-11 15:34:14 +0300 |
---|---|---|
committer | Saku Ytti <saku@ytti.fi> | 2014-06-11 15:34:14 +0300 |
commit | 6434e1a36caf025530363a16f52d77a5780ecc8a (patch) | |
tree | a68c5120605dbf63a8ab6ee57b8ff630f898c169 /lib/oxidized.rb | |
parent | 829654ad75d7329e5d9216899e019417f21d31d1 (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.rb')
0 files changed, 0 insertions, 0 deletions