Class: GnCrossmap::SciNameCollector

Inherits:
Object
  • Object
show all
Defined in:
lib/gn_crossmap/sci_name_collector.rb

Overview

Assemble data from CSV reader by parsing scientificName field

Instance Method Summary collapse

Constructor Details

#initialize(fields) ⇒ SciNameCollector

Returns a new instance of SciNameCollector.



6
7
8
9
# File 'lib/gn_crossmap/sci_name_collector.rb', line 6

def initialize(fields)
  @fields = fields
  @parser = ScientificNameParser.new
end

Instance Method Details

#id_name_rank(row) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/gn_crossmap/sci_name_collector.rb', line 11

def id_name_rank(row)
  @row = row
  name = find_name
  id = GnCrossmap.find_id(@row, name)
  rank = @row[:taxonrank]
  rank = parse_rank if rank.nil?
  id && name ? { id: id, name: name, rank: rank } : nil
end