Class: Specify::Model::Taxon
- Inherits:
-
Object
- Object
- Specify::Model::Taxon
- Includes:
- Createable, Updateable
- Defined in:
- lib/specify/models/taxonomy/taxon.rb
Overview
Taxon is the item class for the Specify::Model::Taxonomy tree. A Taxon holds information about the items to be classified, i.e. concepts of taxonomic names. Each Taxon belongs to a Specify::Model::Rank, that represents its formal Linnean classification rank.
A Taxon has a parent (another instance of Taxon) unless it is the root taxon of the tree and can have children (other instances of Taxon).
Instance Method Summary collapse
-
#before_create ⇒ Object
Assigns new instances that are created from a Specify::Model::Rank to the rank’s Specify::Model::Taxonomy.
-
#children? ⇒ Boolean
Returns
trueifselfhas children. -
#name ⇒ Object
Returns a String with the taxon name.
Methods included from Updateable
Instance Method Details
#before_create ⇒ Object
Assigns new instances that are created from a Specify::Model::Rank to the rank’s Specify::Model::Taxonomy. Assigns a GUID for the record.
37 38 39 40 41 |
# File 'lib/specify/models/taxonomy/taxon.rb', line 37 def before_create self.taxonomy = rank&.taxonomy || parent.rank&.taxonomy self[:GUID] = SecureRandom.uuid super end |
#children? ⇒ Boolean
Returns true if self has children.
44 45 46 |
# File 'lib/specify/models/taxonomy/taxon.rb', line 44 def children? !children.empty? end |
#name ⇒ Object
Returns a String with the taxon name.
49 50 51 |
# File 'lib/specify/models/taxonomy/taxon.rb', line 49 def name self[:Name] end |