Class: MethodObject::PotentialDelegatorWithPrefix
- Inherits:
-
Struct
- Object
- Struct
- MethodObject::PotentialDelegatorWithPrefix
- Defined in:
- lib/method_object.rb
Overview
Represents a possible match of the form:
my_attribute_some_method => my_attribute.some_method
Instance Attribute Summary collapse
-
#attribute ⇒ Object
Returns the value of attribute attribute.
-
#delegated_method ⇒ Object
Returns the value of attribute delegated_method.
-
#object ⇒ Object
Returns the value of attribute object.
Instance Method Summary collapse
Instance Attribute Details
#attribute ⇒ Object
Returns the value of attribute attribute
107 108 109 |
# File 'lib/method_object.rb', line 107 def attribute @attribute end |
#delegated_method ⇒ Object
Returns the value of attribute delegated_method
107 108 109 |
# File 'lib/method_object.rb', line 107 def delegated_method @delegated_method end |
#object ⇒ Object
Returns the value of attribute object
107 108 109 |
# File 'lib/method_object.rb', line 107 def object @object end |
Instance Method Details
#candidate? ⇒ Boolean
109 110 111 |
# File 'lib/method_object.rb', line 109 def candidate? name_matches? && object.respond_to?(method_to_call_on_delegate) end |
#method_to_call_on_delegate ⇒ Object
113 114 115 |
# File 'lib/method_object.rb', line 113 def method_to_call_on_delegate delegated_method.to_s.sub(prefix, '') end |