Class: INatGet::Data::Parser::Part::Details Private

Inherits:
Copy show all
Defined in:
lib/inat-get/data/parsers/defs/details.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.

Instance Attribute Summary

Attributes inherited from INatGet::Data::Parser::Part

#parser

Instance Method Summary collapse

Methods inherited from Copy

#initialize

Methods inherited from INatGet::Data::Parser::Part

#initialize

Constructor Details

This class inherits a constructor from INatGet::Data::Parser::Part::Copy

Instance Method Details

#parse(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.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/inat-get/data/parsers/defs/details.rb', line 7

def parse source
  fields = {}
  @names.each do |name|
    details = source["#{ name }_details".to_sym]
    if details
      data = parse_details details, prefix: name
      fields.merge! data
    end
  end
  @aliases.each do |name, src_name|
    details = source[src_name]
    if details
      data = parse_details details, prefix: name
      fields.merge! data
    end
  end
  fields
end