Module: Usable::ConfigMulti
- Included in:
- Config
- Defined in:
- lib/usable/config_multi.rb
Instance Method Summary collapse
-
#+(other) ⇒ Object
It’s important to define all block specs we need to lazy load Set block specs to nil values so it will fallback to calling the underlying singleton method defined by Config#method_missing.
Instance Method Details
#+(other) ⇒ Object
It’s important to define all block specs we need to lazy load Set block specs to nil values so it will fallback to calling the underlying singleton method defined by Config#method_missing
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/usable/config_multi.rb', line 5 def +(other) config = clone specs = other._spec.to_h specs.each { |key, val| config.spec key, val } methods = other._spec.singleton_methods - specs.keys methods.each do |name| config._spec[name] = nil config._spec.define_singleton_method(name) do other._spec.public_method(name).call end end config end |