Class: Nyanko::Unit::Extender
- Inherits:
-
Object
- Object
- Nyanko::Unit::Extender
- Defined in:
- lib/nyanko/unit/extender.rb,
lib/nyanko/unit/extender/extension.rb,
lib/nyanko/unit/extender/active_record_class_methods.rb
Defined Under Namespace
Modules: ActiveRecordClassMethods Classes: Extension
Instance Method Summary collapse
- #expand(mod, &block) ⇒ Object
-
#initialize(prefix = nil) ⇒ Extender
constructor
A new instance of Extender.
Constructor Details
#initialize(prefix = nil) ⇒ Extender
Returns a new instance of Extender.
7 8 9 |
# File 'lib/nyanko/unit/extender.rb', line 7 def initialize(prefix = nil) @prefix = prefix end |
Instance Method Details
#expand(mod, &block) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/nyanko/unit/extender.rb', line 11 def (mod, &block) mod = mod.to_s.camelize.constantize unless mod.is_a?(Module) extension = Extension.new(mod, @prefix, &block) mod.class_eval do include extension.instance_methods_module extend extension.class_methods_module end end |