Class: TaxonNameRelationship::OriginalCombination

Inherits:
TaxonNameRelationship
  • Object
show all
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.

Defined Under Namespace

Classes: OriginalForm, OriginalGenus, OriginalSpecies, OriginalSubform, OriginalSubgenus, OriginalSubspecies, OriginalSubvariety, OriginalVariety

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.nomenclatural_priorityObject



11
12
13
# File 'app/models/taxon_name_relationship/original_combination.rb', line 11

def self.nomenclatural_priority
  :reverse
end

.order_indexObject

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_rankSymbol

Returns the rank this relationship applies to as a symbol.

Returns:

  • (Symbol)

    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.

Returns:

  • (Hash)

    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_prefixString?

Returns String should be included in Protonym::.

Returns:

  • (String, nil)
    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_statusObject

Returns String the status inferred by the relationship to the object name.

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_subjectObject



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_namesObject (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_statusObject

Returns String the status inferred by the relationship to the subject name.

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_objectObject



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_objectObject (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_priorityObject (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.cached_html_name_and_author_year} should not be younger than #{self.object_taxon_name.cached_html_name_and_author_year}")
  end
end