Class: C11n::Exporter::Ios

Inherits:
Object
  • Object
show all
Defined in:
lib/c11n/exporter/ios.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Ios

Returns a new instance of Ios.



4
5
6
# File 'lib/c11n/exporter/ios.rb', line 4

def initialize(options = {})
  @path = options[:path]
end

Instance Method Details

#export(translations, locale) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/c11n/exporter/ios.rb', line 8

def export(translations, locale)
  file.print(translations.translations_for(locale).map do |key, translation|
    "\"#{key}\" = \"#{translation}\";"
  end.join("\n"))

  file.close
end

#fileObject



16
17
18
# File 'lib/c11n/exporter/ios.rb', line 16

def file
  @file ||= File.new(@path, 'w')
end