Class: I18n::Tasks::Scanners::PrismScanners::ArgumentsVisitor

Inherits:
Prism::Visitor
  • Object
show all
Defined in:
lib/i18n/tasks/scanners/prism_scanners/arguments_visitor.rb

Instance Method Summary collapse

Instance Method Details

#visit_arguments_node(node) ⇒ Object



36
37
38
# File 'lib/i18n/tasks/scanners/prism_scanners/arguments_visitor.rb', line 36

def visit_arguments_node(node)
  node.child_nodes.map { |child| visit(child) }
end

#visit_array_node(node) ⇒ Object



32
33
34
# File 'lib/i18n/tasks/scanners/prism_scanners/arguments_visitor.rb', line 32

def visit_array_node(node)
  node.child_nodes.map { |child| visit(child) }
end

#visit_call_node(_node) ⇒ Object

Cannot handle arguments that are calls



20
21
22
# File 'lib/i18n/tasks/scanners/prism_scanners/arguments_visitor.rb', line 20

def visit_call_node(_node)
  nil
end

#visit_integer_node(node) ⇒ Object



40
41
42
# File 'lib/i18n/tasks/scanners/prism_scanners/arguments_visitor.rb', line 40

def visit_integer_node(node)
  node.value
end

#visit_keyword_hash_node(node) ⇒ Object



10
11
12
13
14
15
16
17
# File 'lib/i18n/tasks/scanners/prism_scanners/arguments_visitor.rb', line 10

def visit_keyword_hash_node(node)
  node.child_nodes.each_with_object({}) do |child, hash|
    next if child.type == :assoc_splat_node

    hash[visit(child.key)] = visit(child.value)
    hash
  end
end

#visit_lambda_node(node) ⇒ Object



44
45
46
# File 'lib/i18n/tasks/scanners/prism_scanners/arguments_visitor.rb', line 44

def visit_lambda_node(node)
  node
end

#visit_string_node(node) ⇒ Object



28
29
30
# File 'lib/i18n/tasks/scanners/prism_scanners/arguments_visitor.rb', line 28

def visit_string_node(node)
  node.content
end

#visit_symbol_node(node) ⇒ Object



24
25
26
# File 'lib/i18n/tasks/scanners/prism_scanners/arguments_visitor.rb', line 24

def visit_symbol_node(node)
  node.value
end