class I18n::Tasks::Scanners::AstMatchers::DefaultI18nSubjectMatcher

Public Instance Methods

convert_to_key_occurrences(send_node, method_name, location: send_node.loc) click to toggle source
# File lib/i18n/tasks/scanners/ast_matchers/default_i18n_subject_matcher.rb, line 8
def convert_to_key_occurrences(send_node, method_name, location: send_node.loc)
  children = Array(send_node&.children)
  return unless children[1] == :default_i18n_subject

  key = @scanner.absolute_key(
    '.subject',
    location.expression.source_buffer.name,
    calling_method: method_name
  )
  [
    key,
    I18n::Tasks::Scanners::Results::Occurrence.from_range(
      raw_key: key,
      range: location.expression
    )
  ]
end