class Pinpoint::Format::List
Attributes
formats[RW]
Public Class Methods
new()
click to toggle source
Public: Initializes a new empty List
# File lib/pinpoint/format/list.rb, line 11 def initialize self.formats = Hash.new end
Public Instance Methods
[](country)
click to toggle source
Public: Retrieves a Format
for the given country.
If the country’s Format
has already been retrieved, it is returned, otherwise it is looked up.
country - The two letter ISO_3166-1 code for the country you’re looking
up the format for.
Example
[:us] # => <Format>
Returns a Format
which corresponds to the given country.
# File lib/pinpoint/format/list.rb, line 31 def [](country) country = country.to_sym get(country) || set(country, Pinpoint::Format.lookup_by_country(country)) end
Private Instance Methods
get(country)
click to toggle source
# File lib/pinpoint/format/list.rb, line 44 def get(country) formats[country] end
set(country, format)
click to toggle source
# File lib/pinpoint/format/list.rb, line 48 def set(country, format) formats[country] = format end