Class: Rucoa::Nodes::ArgNode

Inherits:
Base
  • Object
show all
Defined in:
lib/rucoa/nodes/arg_node.rb

Instance Method Summary collapse

Methods inherited from Base

#ancestors, #child_nodes, #descendant_nodes, #each_ancestor, #each_child_node, #each_descendant_node, #include_position?, #initialize, #module_nesting, #namespace, #next_sibling_nodes, #parent, #parent=, #previous_sibling_nodes, #updated

Constructor Details

This class inherits a constructor from Rucoa::Nodes::Base

Instance Method Details

#nameString

Examples:

returns variable name

node = Rucoa::Source.new(
  content: <<~RUBY,
    def foo(bar)
    end
  RUBY
  uri: 'file:///path/to/example.rb'
).node_at(
  Rucoa::Position.new(
    column: 8,
    line: 1
  )
)
expect(node.name).to eq('bar')

Returns:

  • (String)


21
22
23
# File 'lib/rucoa/nodes/arg_node.rb', line 21

def name
  children[0].to_s
end