Class: I15R::LocaleCreator
- Inherits:
-
Object
- Object
- I15R::LocaleCreator
- Defined in:
- lib/i15r/locale_creator.rb
Defined Under Namespace
Classes: LocaleStructure
Instance Method Summary collapse
- #add(path, value) ⇒ Object
-
#initialize(file_name = nil) ⇒ LocaleCreator
constructor
A new instance of LocaleCreator.
- #save_file ⇒ Object
Constructor Details
#initialize(file_name = nil) ⇒ LocaleCreator
Returns a new instance of LocaleCreator.
5 6 7 8 |
# File 'lib/i15r/locale_creator.rb', line 5 def initialize(file_name = nil) @file_name = file_name @structure = LocaleStructure.new end |
Instance Method Details
#add(path, value) ⇒ Object
10 11 12 13 14 |
# File 'lib/i15r/locale_creator.rb', line 10 def add(path, value) if @file_name @structure.add(path, value) end end |
#save_file ⇒ Object
16 17 18 19 20 21 |
# File 'lib/i15r/locale_creator.rb', line 16 def save_file if @file_name yaml = @structure.to_yaml(:en) File.write("#{@file_name}.yml", yaml) end end |