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



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

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

.i18n=(code) ⇒ Object



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

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

.load_yamlObject



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

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

.localeObject



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

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

.locale=(_locale) ⇒ Object



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

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

.yaml_file_nameObject



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

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