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



107
108
109
# File 'lib/method_object.rb', line 107

def attribute
  @attribute
end

#delegated_methodObject

Returns the value of attribute delegated_method

Returns:

  • (Object)

    the current value of delegated_method



107
108
109
# File 'lib/method_object.rb', line 107

def delegated_method
  @delegated_method
end

#objectObject

Returns the value of attribute object

Returns:

  • (Object)

    the current value of object



107
108
109
# File 'lib/method_object.rb', line 107

def object
  @object
end

Instance Method Details

#candidate?Boolean

Returns:

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



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

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