Module: CollectionObject::BiologicalExtensions

Extended by:
ActiveSupport::Concern
Included in:
CollectionObject
Defined in:
app/models/collection_object/biological_extensions.rb

Overview

This is all code that properly belongs in CollectionObject::BiologicalCollectionObject, but because inheritance sucks sometimes we include it at the top level

Instance Method Summary collapse

Instance Method Details

#missing_determinationObject

see BiologicalCollectionObject


30
31
# File 'app/models/collection_object/biological_extensions.rb', line 30

def missing_determination
end

#name_at_rank_string(rank) ⇒ String

Returns if a determination exists, and the Otu in the determination has a taxon name then return the taxon name at the rank supplied.

Parameters:

  • rank (String)

Returns:

  • (String)

    if a determination exists, and the Otu in the determination has a taxon name then return the taxon name at the rank supplied


35
36
37
# File 'app/models/collection_object/biological_extensions.rb', line 35

def name_at_rank_string(rank)
  current_taxon_name.try(:ancestor_at_rank, rank).try(:cached_html)
end

#reject_otus(attributed) ⇒ Object


44
45
46
47
48
# File 'app/models/collection_object/biological_extensions.rb', line 44

def reject_otus(attributed)
  a = attributed['taxon_name_id']
  b = attributed['name']
  a.blank? && b.blank?
end

#reject_taxon_determinations(attributed) ⇒ Boolean

Returns:

  • (Boolean)

40
41
42
# File 'app/models/collection_object/biological_extensions.rb', line 40

def reject_taxon_determinations(attributed)
  attributed['otu_id'].blank? && attributed[:otu]&.id.blank?
end