Module: Shared::BiologicalExtensions

Extended by:
ActiveSupport::Concern
Included in:
CollectionObject, FieldOccurrence
Defined in:
app/models/concerns/shared/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



76
77
# File 'app/models/concerns/shared/biological_extensions.rb', line 76

def missing_determination
end

#name_at_rank_string(rank) ⇒ String

Ugh: TODO: deprecate! no utility gained here, and it’s HTML!!!

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



86
87
88
# File 'app/models/concerns/shared/biological_extensions.rb', line 86

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

#reject_otus(attributed) ⇒ Object



95
96
97
98
99
# File 'app/models/concerns/shared/biological_extensions.rb', line 95

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

#reject_taxon_determinations(attributed) ⇒ Boolean

Returns:

  • (Boolean)


91
92
93
# File 'app/models/concerns/shared/biological_extensions.rb', line 91

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

#requires_taxon_determination?Boolean

Returns:

  • (Boolean)


79
80
81
# File 'app/models/concerns/shared/biological_extensions.rb', line 79

def requires_taxon_determination?
  false
end