Class: Biggs::Format

Inherits:
Object
  • Object
show all
Defined in:
lib/biggs/format.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(iso_code) ⇒ Format

Returns a new instance of Format.



5
6
7
8
9
# File 'lib/biggs/format.rb', line 5

def initialize(iso_code)
  @iso_code = iso_code.to_s.downcase
  @country_name = Biggs.country_names[@iso_code]
  @format_string = Biggs.formats[@iso_code]
end

Instance Attribute Details

#country_nameObject (readonly)

Returns the value of attribute country_name.



3
4
5
# File 'lib/biggs/format.rb', line 3

def country_name
  @country_name
end

#format_stringObject (readonly)

Returns the value of attribute format_string.



3
4
5
# File 'lib/biggs/format.rb', line 3

def format_string
  @format_string
end

#iso_codeObject (readonly)

Returns the value of attribute iso_code.



3
4
5
# File 'lib/biggs/format.rb', line 3

def iso_code
  @iso_code
end

Class Method Details

.find(iso_code) ⇒ Object



12
13
14
# File 'lib/biggs/format.rb', line 12

def find(iso_code)
  entries_cache[iso_code] ||= new(iso_code)
end