Class: Leftovers::DefinitionNode

Inherits:
AST::Node
  • Object
show all
Defined in:
lib/leftovers/definition_node.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from AST::Node

#arguments, #as_arguments_list, #block_given?, #first, #hash?, #kwargs, #parent, #parent=, #positional_arguments, #privacy, #privacy=, #proc?, #receiver, #scalar?, #second, #sym?, #to_literal_s, #to_scalar_value, #updated

Constructor Details

#initialize(node, name:, location: node.loc.expression) ⇒ DefinitionNode

Returns a new instance of DefinitionNode.



8
9
10
11
12
13
# File 'lib/leftovers/definition_node.rb', line 8

def initialize(node, name:, location: node.loc.expression)
  @name = name
  @path = node.path
  @location = location
  super(:leftovers_definition)
end

Instance Attribute Details

#nameObject (readonly) Also known as: to_sym

Returns the value of attribute name.



5
6
7
# File 'lib/leftovers/definition_node.rb', line 5

def name
  @name
end

#pathObject (readonly)

Returns the value of attribute path.



5
6
7
# File 'lib/leftovers/definition_node.rb', line 5

def path
  @path
end

Instance Method Details

#to_sObject



15
16
17
# File 'lib/leftovers/definition_node.rb', line 15

def to_s
  name.to_s
end