class I18n::Tasks::Angular::Scanners::TranslateAbstract

Public Instance Methods

pattern() click to toggle source
# File lib/i18n/tasks/angular/scanners/translate_abstract.rb, line 26
def pattern
  raise NotImplemented
end
scan_file(path) click to toggle source
# File lib/i18n/tasks/angular/scanners/translate_abstract.rb, line 13
def scan_file(path)
  keys = []
  text = read_file(path)
  text.scan(pattern) do |match|
    src_pos = Regexp.last_match.offset(0).first
    key = strip_literal(match[0])
    location = occurrence_from_position(path, text, src_pos, raw_key: key)
    next unless valid_key?(key)
    keys << [key, location]
  end
  keys
end