Method: String#to_gmt_offset
- Defined in:
- lib/area/string.rb
#to_gmt_offset ⇒ Object
Public: Convert a zipcode to its GMT offset.
Examples
"11211".to_gmt_offset
#=> "-5"
Returns a String representation of the GMT offset.
81 82 83 84 85 86 |
# File 'lib/area/string.rb', line 81 def to_gmt_offset if Area.zip_or_territory?(self.to_s) row = Area.zip_codes.find {|row| row[2] != nil and (row[2].upcase == self.to_s.upcase or row[0] == self.to_s) } row[5] if row end end |