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
18 19 20 21 22 |
# File 'lib/casting/client.rb', line 18 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
28 29 30 31 |
# File 'lib/casting/client.rb', line 28 def cast(delegated_method_name, attendant, ...) validate_attendant(attendant) delegation(delegated_method_name).to(attendant).call(...) end |
#delegate_missing_methods(*which) ⇒ Object
33 34 35 |
# File 'lib/casting/client.rb', line 33 def delegate_missing_methods(*which) Casting::Client.set_delegation_strategy(self.singleton_class, *which.reverse) end |
#delegation(delegated_method_name) ⇒ Object
24 25 26 |
# File 'lib/casting/client.rb', line 24 def delegation(delegated_method_name) Casting::Delegation.prepare(delegated_method_name, self) end |