Module: Decoder

Defined in:
lib/decoder.rb,
lib/decoder/state.rb,
lib/decoder/country.rb,
lib/decoder/countries.rb

Defined Under Namespace

Classes: Countries, Country, State

Class Method Summary collapse

Class Method Details

.i18nObject



8
9
10
# File 'lib/decoder.rb', line 8

def self.i18n
  @i18n ||= :en
end

.i18n=(code) ⇒ Object



12
13
14
15
# File 'lib/decoder.rb', line 12

def self.i18n=(code)
  @i18n = code
  self.locale = nil
end

.load_yamlObject



25
26
27
# File 'lib/decoder.rb', line 25

def self.load_yaml
  Decoder.locale = YAML.load_file(yaml_file_name)
end

.localeObject



17
18
19
# File 'lib/decoder.rb', line 17

def self.locale
  @locale || self.locale = self.load_yaml
end

.locale=(_locale) ⇒ Object



21
22
23
# File 'lib/decoder.rb', line 21

def self.locale=(_locale)
  @locale = _locale
end

.yaml_file_nameObject



29
30
31
# File 'lib/decoder.rb', line 29

def self.yaml_file_name
  "#{File.dirname(__FILE__)}/locales/#{Decoder.i18n}.yml"
end