Class: I18nInterpolationSpec::LocaleFile

Inherits:
Object
  • Object
show all
Defined in:
lib/i18n_interpolation_spec/locale_file.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filepath) ⇒ LocaleFile

Returns a new instance of LocaleFile.



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

def initialize(filepath)
  @filepath = filepath
end

Instance Attribute Details

#filepathObject

Returns the value of attribute filepath.



6
7
8
# File 'lib/i18n_interpolation_spec/locale_file.rb', line 6

def filepath
  @filepath
end

Instance Method Details

#contentObject



12
13
14
# File 'lib/i18n_interpolation_spec/locale_file.rb', line 12

def content
  @content ||= File.read @filepath
end

#content_yamlObject



16
17
18
# File 'lib/i18n_interpolation_spec/locale_file.rb', line 16

def content_yaml
  @content_yaml ||= YAML.load(content).freeze
end

#localeObject



20
21
22
# File 'lib/i18n_interpolation_spec/locale_file.rb', line 20

def locale
  @locale ||= content_yaml.keys.first
end

#translationsObject



24
25
26
# File 'lib/i18n_interpolation_spec/locale_file.rb', line 24

def translations
  content_yaml[locale]
end