Class: MethodObject::PotentialDelegatorWithPrefix

Inherits:
Struct
  • Object
show all
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

Instance Method Summary collapse

Instance Attribute Details

#attributeObject

Returns the value of attribute attribute

Returns:

  • (Object)

    the current value of attribute



114
115
116
# File 'lib/method_object.rb', line 114

def attribute
  @attribute
end

#delegated_methodObject

Returns the value of attribute delegated_method

Returns:

  • (Object)

    the current value of delegated_method



114
115
116
# File 'lib/method_object.rb', line 114

def delegated_method
  @delegated_method
end

#objectObject

Returns the value of attribute object

Returns:

  • (Object)

    the current value of object



114
115
116
# File 'lib/method_object.rb', line 114

def object
  @object
end

Instance Method Details

#candidate?Boolean

Returns:

  • (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_delegateObject



120
121
122
# File 'lib/method_object.rb', line 120

def method_to_call_on_delegate
  delegated_method.to_s.sub(prefix, '')
end