Class: INatGet::Data::Parser::Part::Links Private
- Inherits:
-
Assoc
- Object
- INatGet::Data::Parser::Part
- Assoc
- INatGet::Data::Parser::Part::Links
- Defined in:
- lib/inat-get/data/parsers/defs/links.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from INatGet::Data::Parser::Part
Instance Method Summary collapse
- #parse(target, source) ⇒ Object private
Methods inherited from Assoc
Methods inherited from INatGet::Data::Parser::Part
Constructor Details
This class inherits a constructor from INatGet::Data::Parser::Part::Assoc
Instance Method Details
#parse(target, source) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/inat-get/data/parsers/defs/links.rb', line 5 def parse target, source data = source[@source] values = if data @model.parser.parse! data else ids = source[@source_ids] || [] @model.manager.get(*ids) end ids = Array(values).map(&:id) field = @parser.model.association_reflection(@name)[:pks_setter_method].to_s.chomp('=').gsub('_setter', '').to_sym { field => ids } end |