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: "    def foo(bar)\n    end\n  RUBY\n  uri: 'file:///path/to/example.rb'\n).node_at(\n  Rucoa::Position.new(\n    column: 8,\n    line: 1\n  )\n)\nexpect(node.name).to eq('bar')\n",

Returns:

  • (String)


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

def name
  children[0].to_s
end