Class: Catalog::Otu::Entry

Inherits:
Entry
  • Object
show all
Defined in:
lib/catalog/otu/entry.rb

Instance Attribute Summary

Attributes inherited from Entry

#dates, #item_index, #items, #object, #sort_order, #sources, #topics

Instance Method Summary collapse

Methods inherited from Entry

#all_citations, #all_dates, #all_sources, #all_topics, #citations, #coordinate_entry_items, #date_range, #first_item?, #index_items, #is_subsequent_entry_item?, #items_by_object, #last_item?, #ordered_by_nomenclature_date, #original_citation_present?, #to_json, #topics_for_source, #year_hash

Constructor Details

#initialize(otu) ⇒ Entry

Returns a new instance of Entry.



6
7
8
9
# File 'lib/catalog/otu/entry.rb', line 6

def initialize(otu)
  super(otu)
  true
end

Instance Method Details

#buildObject



11
12
13
14
# File 'lib/catalog/otu/entry.rb', line 11

def build
  from_self
  true
end

#entry_item_matches_target?(item_object, reference_object) ⇒ Boolean

Returns this is the MM result.

Returns:

  • (Boolean)

    this is the MM result



50
51
52
# File 'lib/catalog/otu/entry.rb', line 50

def entry_item_matches_target?(item_object, reference_object)
  item_object.taxon_name_id == reference_object.taxon_name_id
end

#from_selfObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/catalog/otu/entry.rb', line 20

def from_self
  a = ::Otu.coordinate_otus(object.id).load

  # It's just this OTU, and it's never been cited, 
  # or cross-referenced to another name, etc.
  if a.size == 1 && object.citations.none?
    @items << Catalog::Otu::EntryItem.new(
      object: object,
      base_object: object,
      current_target: true # by definition?
    )
  end

  a.each do |o|
    matches_target = entry_item_matches_target?(o, object)

    o.citations.each do |c|
      @items << Catalog::Otu::EntryItem.new(
        object: o,
        base_object: object,
        citation: c,
        nomenclature_date: c.source&.cached_nomenclature_date,
        current_target: matches_target
      )
    end
  end
end

#to_html_methodObject



16
17
18
# File 'lib/catalog/otu/entry.rb', line 16

def to_html_method
  :otu_catalog_entry_item_to_html
end