lib/i18n/tasks/scanners/pattern_scanner.rb in i18n-tasks-0.3.6 vs lib/i18n/tasks/scanners/pattern_scanner.rb in i18n-tasks-0.3.7
- old
+ new
@@ -3,17 +3,17 @@
module I18n::Tasks::Scanners
# Scans for I18n.t usages
#
class PatternScanner < BaseScanner
# Extract i18n keys from file based on the pattern which must capture the key literal.
- # @return [String] keys found in file
+ # @return [Array<Key>] keys found in file
def scan_file(path, text = read_file(path))
keys = []
text.scan(pattern) do |match|
src_pos = Regexp.last_match.offset(0).first
key = match_to_key(match, path)
next unless valid_key?(key)
- keys << ::I18n::Tasks::Key.new(key, usage_context(text, src_pos))
+ keys << ::I18n::Tasks::Key.new(key, src_location(text, src_pos))
end
keys
end
def default_pattern