Class: I15R::LocaleCreator

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

Defined Under Namespace

Classes: LocaleStructure

Instance Method Summary collapse

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_fileObject



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