Class: TaxonNameRelationship::OriginalCombination
- Inherits:
-
TaxonNameRelationship
- Object
- TaxonNameRelationship
- TaxonNameRelationship::OriginalCombination
- Defined in:
- app/models/taxon_name_relationship/original_combination.rb
Overview
Discussion (MJY, DD, 1/9/15) - It may be that this is semantically identical to Combination, and that we can infer the difference, i.e. functionality might get simplified/merged in the future.
Conclusion- remains fixed as is, Combination becomes citable, Protonym not.
Direct Known Subclasses
OriginalForm, OriginalGenus, OriginalSpecies, OriginalSubform, OriginalSubgenus, OriginalSubspecies, OriginalSubvariety, OriginalVariety
Defined Under Namespace
Classes: OriginalForm, OriginalGenus, OriginalSpecies, OriginalSubform, OriginalSubgenus, OriginalSubspecies, OriginalSubvariety, OriginalVariety
Class Method Summary collapse
- .nomenclatural_priority ⇒ Object
-
.order_index ⇒ Object
TODO: Why only ICN?.
Instance Method Summary collapse
-
#applicable_rank ⇒ Symbol
The rank this relationship applies to as a symbol.
-
#combination_name(name_gender = nil) ⇒ Hash
Like { genus: [nil, 'Aus'] ... } the elements of the original combination name for this instance TODO: reconcile this with <>_name_elements for other combinations.
-
#monominal_prefix ⇒ String?
String should be included in Protonym::.
-
#object_status ⇒ Object
String the status inferred by the relationship to the object name.
- #object_status_connector_to_subject ⇒ Object
- #set_cached_names_for_taxon_names ⇒ Object protected
-
#subject_status ⇒ Object
String the status inferred by the relationship to the subject name.
- #subject_status_connector_to_object ⇒ Object
- #sv_coordinated_taxa_object ⇒ Object protected
- #sv_validate_priority ⇒ Object protected
Class Method Details
.nomenclatural_priority ⇒ Object
11 12 13 |
# File 'app/models/taxon_name_relationship/original_combination.rb', line 11 def self.nomenclatural_priority :reverse end |
.order_index ⇒ Object
TODO: Why only ICN?
22 23 24 |
# File 'app/models/taxon_name_relationship/original_combination.rb', line 22 def self.order_index RANKS.index(::ICN_LOOKUP[self.name.demodulize.underscore.humanize.downcase.gsub('original ', '')]) end |
Instance Method Details
#applicable_rank ⇒ Symbol
Returns the rank this relationship applies to as a symbol.
17 18 19 |
# File 'app/models/taxon_name_relationship/original_combination.rb', line 17 def applicable_rank self.class.name.demodulize.underscore.humanize.downcase.gsub('original ', '').to_sym end |
#combination_name(name_gender = nil) ⇒ Hash
Returns like { genus: [nil, 'Aus'] ... } the elements of the original combination name for this instance TODO: reconcile this with <>_name_elements for other combinations. TODO: reconcile this format with that of full_name_hash.
61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'app/models/taxon_name_relationship/original_combination.rb', line 61 def combination_name(name_gender = nil) elements = [monominal_prefix] if subject_taxon_name.verbatim_name.present? && name_gender.nil? elements.push subject_taxon_name.verbatim_name else elements.push subject_taxon_name.genderized_name(name_gender) end elements.push('[sic]') if subject_taxon_name.cached_misspelling # TODO [sic] as seperated is different than FNH, and also see () elements[1] = "(#{elements[1]})" if applicable_rank == :subgenus return {applicable_rank => elements} end |
#monominal_prefix ⇒ String?
Returns String should be included in Protonym::.
52 53 54 |
# File 'app/models/taxon_name_relationship/original_combination.rb', line 52 def monominal_prefix nil end |
#object_status ⇒ Object
Returns String the status inferred by the relationship to the object name.
42 43 44 |
# File 'app/models/taxon_name_relationship/original_combination.rb', line 42 def object_status 'in original combination with ' + self.type_name.demodulize.underscore.humanize.downcase end |
#object_status_connector_to_subject ⇒ Object
26 27 28 |
# File 'app/models/taxon_name_relationship/original_combination.rb', line 26 def object_status_connector_to_subject ' with' end |
#set_cached_names_for_taxon_names ⇒ Object (protected)
77 78 79 80 |
# File 'app/models/taxon_name_relationship/original_combination.rb', line 77 def set_cached_names_for_taxon_names object_taxon_name.reload object_taxon_name.update_cached_original_combinations end |
#subject_status ⇒ Object
Returns String the status inferred by the relationship to the subject name.
32 33 34 |
# File 'app/models/taxon_name_relationship/original_combination.rb', line 32 def subject_status 'as ' + self.type_name.demodulize.underscore.humanize.downcase end |
#subject_status_connector_to_object ⇒ Object
36 37 38 |
# File 'app/models/taxon_name_relationship/original_combination.rb', line 36 def subject_status_connector_to_object ' of' end |
#sv_coordinated_taxa_object ⇒ Object (protected)
90 91 92 |
# File 'app/models/taxon_name_relationship/original_combination.rb', line 90 def sv_coordinated_taxa_object true # not applicable end |
#sv_validate_priority ⇒ Object (protected)
82 83 84 85 86 87 88 |
# File 'app/models/taxon_name_relationship/original_combination.rb', line 82 def sv_validate_priority date1 = self.subject_taxon_name.cached_nomenclature_date date2 = self.object_taxon_name.cached_nomenclature_date if !!date1 && !!date2 && date1 > date2 && subject_invalid_statuses.empty? soft_validations.add(:type, "#{self.subject_status.capitalize} #{self.subject_taxon_name.} should not be younger than #{self.object_taxon_name.}") end end |