Module: BothIsGood::ClassMethods
- Defined in:
- lib/both_is_good.rb
Instance Method Summary collapse
- #both_is_good_configuration ⇒ Object
- #both_is_good_configure(base = nil, **overrides) ⇒ Object
- #implemented_twice(*positional, original: nil, replacement: nil, **opts) ⇒ Object
Instance Method Details
#both_is_good_configuration ⇒ Object
25 26 27 |
# File 'lib/both_is_good.rb', line 25 def both_is_good_configuration @both_is_good_configuration || BothIsGood.configuration end |
#both_is_good_configure(base = nil, **overrides) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/both_is_good.rb', line 16 def both_is_good_configure(base = nil, **overrides) @both_is_good_configuration = if base Configuration.new(base, **overrides) else Configuration.new(**overrides) end end |
#implemented_twice(*positional, original: nil, replacement: nil, **opts) ⇒ Object
29 30 31 32 33 34 35 36 37 |
# File 'lib/both_is_good.rb', line 29 def implemented_twice(*positional, original: nil, replacement: nil, **opts) implementer = DualImplementer.new(*positional, target: self, original:, replacement:, **opts) implementer.apply_aliases! runner = implementer.implementation define_method(implementer.name) do |*args, **kwargs| runner.call(BothIsGood::Target.new(self, implementer.name, self.class), *args, **kwargs) end end |