Class: TaxonReporter::Report

Inherits:
Object
  • Object
show all
Defined in:
lib/taxon_reporter/report.rb

Constant Summary collapse

@@data_sources =
Set.new([EolDataSource])

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Report

Returns a new instance of Report.



10
11
12
13
14
# File 'lib/taxon_reporter/report.rb', line 10

def initialize(name)
  @taxons = []
  @fields = []
  TaxonReporter::Report.load_data(name).each {|t| add_taxon(t)}
end

Class Method Details

.load_data(name) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/taxon_reporter/report.rb', line 16

def self.load_data(name)
  result = []
  @@data_sources.each do |ds|
    result += ds.taxons_from_name(name)
  end
  result
end

Instance Method Details

#add_taxon(taxon) ⇒ Object



24
25
26
27
# File 'lib/taxon_reporter/report.rb', line 24

def add_taxon(taxon)
  @taxons.push(taxon)
  @fields += taxon.fields      
end

#fieldsObject



8
# File 'lib/taxon_reporter/report.rb', line 8

def fields; @fields; end

#taxonsObject



7
# File 'lib/taxon_reporter/report.rb', line 7

def taxons; @taxons; end