class I18n::Tasks::Scanners::RubyAstCallFinder

Public Instance Methods

collect_calls(root_node) click to toggle source

@param root_node [Parser::AST:Node] @return [Pair<Parser::AST::Node, method_name as string>] for all nodes with :send type

# File lib/i18n/tasks/scanners/ruby_ast_call_finder.rb, line 11
def collect_calls(root_node)
  @results = []
  process(root_node)
  @results
end
handler_missing(node) click to toggle source
# File lib/i18n/tasks/scanners/ruby_ast_call_finder.rb, line 32
def handler_missing(node)
  node.children.each { |child| process(child) if child.is_a?(::Parser::AST::Node) }
  nil
end
on_def(node) click to toggle source
# File lib/i18n/tasks/scanners/ruby_ast_call_finder.rb, line 17
def on_def(node)
  @method_name = node.children[0]
  handler_missing(node)
ensure
  @method_name = nil
end
on_send(send_node) click to toggle source
# File lib/i18n/tasks/scanners/ruby_ast_call_finder.rb, line 24
def on_send(send_node)
  @results << [send_node, @method_name]

  # always invoke handler_missing to get nested translations in children
  handler_missing(send_node)
  nil
end