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
114 115 116 |
# File 'lib/method_object.rb', line 114 def attribute @attribute end |
#delegated_method ⇒ Object
Returns the value of attribute delegated_method
114 115 116 |
# File 'lib/method_object.rb', line 114 def delegated_method @delegated_method end |
#object ⇒ Object
Returns the value of attribute object
114 115 116 |
# File 'lib/method_object.rb', line 114 def object @object end |
Instance Method Details
#candidate? ⇒ Boolean
116 117 118 |
# File 'lib/method_object.rb', line 116 def candidate? name_matches? && object.respond_to?(method_to_call_on_delegate) end |
#method_to_call_on_delegate ⇒ Object
120 121 122 |
# File 'lib/method_object.rb', line 120 def method_to_call_on_delegate delegated_method.to_s.sub(prefix, '') end |