lib/i18n/tasks/scanners/pattern_scanner.rb in i18n-tasks-0.9.2 vs lib/i18n/tasks/scanners/pattern_scanner.rb in i18n-tasks-0.9.3

- old
+ new

@@ -1,5 +1,6 @@ +# frozen_string_literal: true require 'i18n/tasks/scanners/file_scanner' require 'i18n/tasks/scanners/relative_keys' require 'i18n/tasks/scanners/occurrence_from_position' module I18n::Tasks::Scanners @@ -15,16 +16,16 @@ end protected # Extract i18n keys from file based on the pattern which must capture the key literal. - # @return [Array<[key, Results::KeyOccurrence]>] each occurrence found in the file + # @return [Array<[key, Results::Occurrence]>] each occurrence found in the file def scan_file(path) keys = [] text = read_file(path) text.scan(@pattern) do |match| src_pos = Regexp.last_match.offset(0).first - location = occurrence_from_position(path, text, src_pos) + location = occurrence_from_position(path, text, src_pos, raw_key: strip_literal(match[0])) next if exclude_line?(location.line, path) key = match_to_key(match, path, location) next unless key key = key + ':'.freeze if key.end_with?('.'.freeze) next unless valid_key?(key)