Class: Specify::Model::GeographicName
- Inherits:
-
Object
- Object
- Specify::Model::GeographicName
- Includes:
- Updateable
- Defined in:
- lib/specify/models/geography/geographic_name.rb
Overview
GeographicName is the item class for the Specify::Model::Geography tree. A GeographicName holds information about the items to be classified, i.e. concepts of geographic names. Each GeographicName belongs to a Specify::Model::AdministrativeDivision, that represents the formal political subdivision in a geography.
A GeographicName has a parent (another instance of GeographicName) unless it is the root geographic name of the tree and can have children (other instances of GeographicName).
Instance Method Summary collapse
-
#before_create ⇒ Object
Assigns new instances that are created from a Specify::Model::AdministrativeDivision to the administrative division’s Specify::Model::Geography.
-
#children? ⇒ Boolean
Returns
trueifselfhas children. -
#inspect ⇒ Object
Creates a string representation of
self. -
#name ⇒ Object
Returns a String with the geographic name.
Methods included from Updateable
Instance Method Details
#before_create ⇒ Object
Assigns new instances that are created from a Specify::Model::AdministrativeDivision to the administrative division’s Specify::Model::Geography. Sets Version, timestamp for creation, and a GUID for the record.
41 42 43 44 45 46 47 48 |
# File 'lib/specify/models/geography/geographic_name.rb', line 41 def before_create self.geography = rank&.geography || parent.rank&.geography self[:Version] = 0 self[:TimestampCreated] = Time.now self[:GUID] = SecureRandom.uuid super end |
#children? ⇒ Boolean
Returns true if self has children.
51 52 53 |
# File 'lib/specify/models/geography/geographic_name.rb', line 51 def children? !children.empty? end |
#inspect ⇒ Object
Creates a string representation of self.
56 57 58 |
# File 'lib/specify/models/geography/geographic_name.rb', line 56 def inspect "id: #{self.GeographyID}; Full Name: '#{self.FullName}'" end |
#name ⇒ Object
Returns a String with the geographic name.
61 62 63 |
# File 'lib/specify/models/geography/geographic_name.rb', line 61 def name self[:Name] end |