class Applyrics::StringsFile::Parser
Public Class Methods
new(hash)
click to toggle source
# File lib/applyrics/stringsfile.rb, line 61 def initialize(hash) @hash = hash @property_regex = %r/\A(.*?)=(.*)\z/u @quote = %r/"([^"]+)"/u @open_quote = %r/\A\s*(".*)\z/u @comment_regex = %r/\/\*([^*]+)\*\//u end
Public Instance Methods
parse(data)
click to toggle source
# File lib/applyrics/stringsfile.rb, line 69 def parse(data) @hash.clear data.each_line do |line| @line = line.chomp case @line when @comment_regex # Not implemented when @property_regex key = strip($1) value = strip($2) @hash[key] = value end end @hash end
strip(value)
click to toggle source
# File lib/applyrics/stringsfile.rb, line 87 def strip(value) str = @quote.match(value.strip) if str.nil? value.strip else str[1] end end