class Lokale::Macro
Attributes
found_strings[R]
key_index[RW]
localization_file[RW]
name[RW]
note_index[RW]
project_file[RW]
regex[RW]
Public Class Methods
new(name)
click to toggle source
# File lib/lokale/model.rb, line 83 def initialize(name) @name = name clear_calls end
Public Instance Methods
clear_calls()
click to toggle source
# File lib/lokale/model.rb, line 88 def clear_calls @found_strings = Hash.new { |h, k| h[k] = 0 } end
read_from(file)
click to toggle source
# File lib/lokale/model.rb, line 92 def read_from(file) file.scan(@regex) do |m| lang = Config.get.main_lang key = m[key_index] unless key_index.nil? val = m[note_index] unless note_index.nil? lstr = LString.new(key, val, val, lang) @found_strings[lstr] += 1 end end
total_count()
click to toggle source
# File lib/lokale/model.rb, line 106 def total_count @found_strings.values.reduce(:+) || 0 end
uniq_count()
click to toggle source
# File lib/lokale/model.rb, line 102 def uniq_count @found_strings.size end