Class: Arspy::Operators::Interpreter::AbbreviatedAssociationInterpreter

Inherits:
AssociationInterpreter show all
Includes:
Abbreviations
Defined in:
lib/arspy/operators/interpreter/abbreviated_association_interpreter.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Abbreviations

included, #resolve_abbreviation_for_attributes_and_associations!

Methods inherited from AssociationInterpreter

#interpret

Constructor Details

#initialize(array, method_name) ⇒ AbbreviatedAssociationInterpreter

Returns a new instance of AbbreviatedAssociationInterpreter.



13
14
15
16
# File 'lib/arspy/operators/interpreter/abbreviated_association_interpreter.rb', line 13

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)


8
9
10
11
# File 'lib/arspy/operators/interpreter/abbreviated_association_interpreter.rb', line 8

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