class Applyrics::StringsFile
Public Class Methods
new(path, data=nil)
click to toggle source
# File lib/applyrics/stringsfile.rb, line 5 def initialize(path, data=nil) @path = path @hash = data if data.nil? read end end
Public Instance Methods
have_key?()
click to toggle source
# File lib/applyrics/stringsfile.rb, line 17 def have_key? # Not implemented... end
keys()
click to toggle source
# File lib/applyrics/stringsfile.rb, line 13 def keys # Not implemented... end
read()
click to toggle source
# File lib/applyrics/stringsfile.rb, line 29 def read @hash = {} parser = Parser.new(@hash) File.open(@path, 'rb:bom|utf-16LE:utf-8') { |fd| parser.parse fd } self end
string_for_key(key)
click to toggle source
# File lib/applyrics/stringsfile.rb, line 21 def string_for_key(key) # Not implemented... end
to_hash()
click to toggle source
# File lib/applyrics/stringsfile.rb, line 25 def to_hash @hash end
write()
click to toggle source
# File lib/applyrics/stringsfile.rb, line 36 def write temp = Tempfile.new(File.basename(@path)) begin gen = Generator.new(@hash) gen.run { |line| temp.puts line } FileUtils.mv(temp.path, @path) ensure temp.close end end