Module: Casting::Client
- Defined in:
- lib/casting/client.rb
Class Method Summary collapse
Instance Method Summary collapse
- #cast(delegated_method_name, attendant) ⇒ Object
- #delegate_missing_methods(*which) ⇒ Object
- #delegation(delegated_method_name) ⇒ Object
Class Method Details
.extended(base) ⇒ Object
17 18 19 20 21 |
# File 'lib/casting/client.rb', line 17 def self.extended(base) unless base.respond_to?(:delegate) add_delegate_method_to(base.singleton_class) end end |
Instance Method Details
#cast(delegated_method_name, attendant) ⇒ Object
27 28 29 30 |
# File 'lib/casting/client.rb', line 27 def cast(delegated_method_name, attendant, ...) validate_attendant(attendant) delegation(delegated_method_name).to(attendant).call(...) end |
#delegate_missing_methods(*which) ⇒ Object
32 33 34 |
# File 'lib/casting/client.rb', line 32 def delegate_missing_methods(*which) Casting::Client.set_delegation_strategy(singleton_class, *which.reverse) end |
#delegation(delegated_method_name) ⇒ Object
23 24 25 |
# File 'lib/casting/client.rb', line 23 def delegation(delegated_method_name) Casting::Delegation.prepare(delegated_method_name, self) end |