Module: L43::Core::Forwarder
Instance Method Summary collapse
- #forward(message, to:, as: nil) ⇒ Object
- #forward_all(*messages, to:) ⇒ Object
- #forward_self(method:, to:, as: nil) ⇒ Object
Instance Method Details
#forward(message, to:, as: nil) ⇒ Object
9 10 11 12 |
# File 'lib/l43/core/forwarder.rb', line 9 def forward(, to:, as: nil) as ||= def_delegator(to, as, ) end |
#forward_all(*messages, to:) ⇒ Object
14 15 16 |
# File 'lib/l43/core/forwarder.rb', line 14 def forward_all(*, to:) def_delegators(to, *) end |
#forward_self(method:, to:, as: nil) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/l43/core/forwarder.rb', line 18 def forward_self(method:, to:, as: nil) as ||= method define_method(method) do |*a, **k, &b| to.send(as, *[self, *a], **k, &b) end end |