Class: Catalog::Otu::Entry
Overview
A Catalog::Entry has many entry items. Together CatalogEntrys form a Catalog
Instance Attribute Summary
Attributes inherited from Entry
#dates, #item_index, #items, #object, #sort_order, #sources, #topics
Instance Method Summary collapse
- #build ⇒ Object
-
#entry_item_matches_target?(item_object, reference_object) ⇒ Boolean
This is the MM result.
- #from_self ⇒ Object
-
#initialize(otu) ⇒ Entry
constructor
A new instance of Entry.
- #to_html_method ⇒ Object
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.
4 5 6 7 |
# File 'lib/catalog/otu/entry.rb', line 4 def initialize(otu) super(otu) true end |
Instance Method Details
#build ⇒ Object
9 10 11 12 |
# File 'lib/catalog/otu/entry.rb', line 9 def build from_self true end |
#entry_item_matches_target?(item_object, reference_object) ⇒ Boolean
Returns this is the MM result.
48 49 50 |
# File 'lib/catalog/otu/entry.rb', line 48 def entry_item_matches_target?(item_object, reference_object) item_object.taxon_name_id == reference_object.taxon_name_id end |
#from_self ⇒ Object
18 19 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 |
# File 'lib/catalog/otu/entry.rb', line 18 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_method ⇒ Object
14 15 16 |
# File 'lib/catalog/otu/entry.rb', line 14 def to_html_method :otu_catalog_entry_item_to_html end |