Class: I18nInterpolationSpec::LocaleFile
- Inherits:
-
Object
- Object
- I18nInterpolationSpec::LocaleFile
- Defined in:
- lib/i18n_interpolation_spec/locale_file.rb
Instance Attribute Summary collapse
-
#filepath ⇒ Object
Returns the value of attribute filepath.
Instance Method Summary collapse
- #content ⇒ Object
- #content_yaml ⇒ Object
-
#initialize(filepath) ⇒ LocaleFile
constructor
A new instance of LocaleFile.
- #locale ⇒ Object
- #translations ⇒ Object
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
#filepath ⇒ Object
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
#content ⇒ Object
12 13 14 |
# File 'lib/i18n_interpolation_spec/locale_file.rb', line 12 def content @content ||= File.read @filepath end |
#content_yaml ⇒ Object
16 17 18 |
# File 'lib/i18n_interpolation_spec/locale_file.rb', line 16 def content_yaml @content_yaml ||= YAML.load(content).freeze end |
#locale ⇒ Object
20 21 22 |
# File 'lib/i18n_interpolation_spec/locale_file.rb', line 20 def locale @locale ||= content_yaml.keys.first end |
#translations ⇒ Object
24 25 26 |
# File 'lib/i18n_interpolation_spec/locale_file.rb', line 24 def translations content_yaml[locale] end |