Class: Pinpoint::Format::List
- Inherits:
-
Object
- Object
- Pinpoint::Format::List
- Includes:
- Enumerable
- Defined in:
- lib/pinpoint/format/list.rb
Instance Method Summary collapse
-
#[](country) ⇒ Object
Public: Retrieves a Format for the given country.
-
#initialize ⇒ List
constructor
Public: Initializes a new empty List.
Constructor Details
#initialize ⇒ List
Public: Initializes a new empty List
11 12 13 |
# File 'lib/pinpoint/format/list.rb', line 11 def initialize self.formats = Hash.new end |
Instance Method Details
#[](country) ⇒ Object
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.
31 32 33 34 35 36 |
# 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 |