Class: Arspy::Operators::Interpreter::AbbreviatedAttributeInterpreter

Inherits:
AttributeInterpreter show all
Includes:
Abbreviations
Defined in:
lib/arspy/operators/interpreter/abbreviated_attribute_interpreter.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Abbreviations

included, #resolve_abbreviation_for_attributes_and_associations!

Methods inherited from AttributeInterpreter

#interpret

Constructor Details

#initialize(array, method_name) ⇒ AbbreviatedAttributeInterpreter

Returns a new instance of AbbreviatedAttributeInterpreter.



14
15
16
17
# File 'lib/arspy/operators/interpreter/abbreviated_attribute_interpreter.rb', line 14

def initialize(array, method_name)
  descriptor = resolve_abbreviation_for_attributes_and_associations!(array.first, method_name)
  super(array, descriptor[:method_name])
end

Class Method Details

.applies?(array, method_name) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
12
# File 'lib/arspy/operators/interpreter/abbreviated_attribute_interpreter.rb', line 9

def self.applies?(array, method_name)
  descriptor = resolve_abbreviation_for_attributes_and_associations!(array.first, method_name)
  descriptor && descriptor[:type] == :attribute
end