Class: I15R::LocaleCreator::LocaleStructure
- Inherits:
-
Object
- Object
- I15R::LocaleCreator::LocaleStructure
- Defined in:
- lib/i15r/locale_creator.rb
Instance Attribute Summary collapse
-
#structure ⇒ Object
readonly
Returns the value of attribute structure.
Instance Method Summary collapse
- #add(path, value) ⇒ Object
-
#initialize ⇒ LocaleStructure
constructor
A new instance of LocaleStructure.
- #to_yaml(language) ⇒ Object
Constructor Details
#initialize ⇒ LocaleStructure
Returns a new instance of LocaleStructure.
26 27 28 |
# File 'lib/i15r/locale_creator.rb', line 26 def initialize @structure = {} end |
Instance Attribute Details
#structure ⇒ Object (readonly)
Returns the value of attribute structure.
24 25 26 |
# File 'lib/i15r/locale_creator.rb', line 24 def structure @structure end |
Instance Method Details
#add(path, value) ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/i15r/locale_creator.rb', line 30 def add(path, value) keys = path.dup.split('.') h = nested_hash_for(keys, value) @structure = deep_merge(self.structure, h) end |
#to_yaml(language) ⇒ Object
38 39 40 |
# File 'lib/i15r/locale_creator.rb', line 38 def to_yaml(language) { language.to_s => @structure }.to_yaml end |