Class: I15R::LocaleCreator::LocaleStructure

Inherits:
Object
  • Object
show all
Defined in:
lib/i15r/locale_creator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeLocaleStructure

Returns a new instance of LocaleStructure.



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

def initialize
  @structure = {}
end

Instance Attribute Details

#structureObject (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