Class: Graticule::Precision
- Inherits:
-
Object
- Object
- Graticule::Precision
- Includes:
- Comparable
- Defined in:
- lib/graticule/precision.rb
Overview
Used to compare the precision of different geocoded locations
Constant Summary collapse
- NAMES =
[ :unknown, :country, :region, :locality, :postal_code, :street, :address, :premise ]
- Unknown =
Precision.new(:unknown)
- Country =
Precision.new(:country)
- Region =
Precision.new(:region)
- Locality =
Precision.new(:locality)
- PostalCode =
Precision.new(:postal_code)
- Street =
Precision.new(:street)
- Address =
Precision.new(:address)
- Premise =
Precision.new(:premise)
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #==(other) ⇒ Object
-
#initialize(name) ⇒ Precision
constructor
A new instance of Precision.
- #to_s ⇒ Object
Constructor Details
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/graticule/precision.rb', line 7 def name @name end |
Instance Method Details
#<=>(other) ⇒ Object
38 39 40 41 |
# File 'lib/graticule/precision.rb', line 38 def <=>(other) other = Precision.new(other) unless other.is_a?(Precision) NAMES.index(self.name) <=> NAMES.index(other.name) end |
#==(other) ⇒ Object
43 44 45 |
# File 'lib/graticule/precision.rb', line 43 def ==(other) (self <=> other) == 0 end |
#to_s ⇒ Object
34 35 36 |
# File 'lib/graticule/precision.rb', line 34 def to_s @name.to_s end |