Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/string_conversions.rb
Instance Attribute Summary collapse
-
#coordinates ⇒ Object
Returns the value of attribute coordinates.
Instance Method Summary collapse
- #is_gridref? ⇒ Boolean
- #is_latlng? ⇒ Boolean
- #to_latlng(options = {}) ⇒ Object
- #to_wgs84(options = {}) ⇒ Object
Instance Attribute Details
#coordinates ⇒ Object
Returns the value of attribute coordinates.
3 4 5 |
# File 'lib/string_conversions.rb', line 3 def coordinates @coordinates end |
Instance Method Details
#is_gridref? ⇒ Boolean
5 6 7 |
# File 'lib/string_conversions.rb', line 5 def is_gridref? !!(self.upcase =~ /^(H(P|T|U|Y|Z)|N(A|B|C|D|F|G|H|J|K|L|M|N|O|R|S|T|U|W|X|Y|Z)|OV|S(C|D|E|G|H|J|K|M|N|O|P|R|S|T|U|W|X|Y|Z)|T(A|F|G|L|M|Q|R|V)){1}\d{4}(NE|NW|SE|SW)?$|((H(P|T|U|Y|Z)|N(A|B|C|D|F|G|H|J|K|L|M|N|O|R|S|T|U|W|X|Y|Z)|OV|S(C|D|E|G|H|J|K|M|N|O|P|R|S|T|U|W|X|Y|Z)|T(A|F|G|L|M|Q|R|V)){1}(\d{4}|\d{6}|\d{8}|\d{10}))$/) end |
#is_latlng? ⇒ Boolean
9 10 11 |
# File 'lib/string_conversions.rb', line 9 def is_latlng? !!coordinates end |