Class: Leftovers::DefinitionNode
- Defined in:
- lib/leftovers/definition_node.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
(also: #to_sym)
readonly
Returns the value of attribute name.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(node, name:, location: node.loc.expression) ⇒ DefinitionNode
constructor
A new instance of DefinitionNode.
- #to_s ⇒ Object
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
#name ⇒ Object (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 |
#path ⇒ Object (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_s ⇒ Object
15 16 17 |
# File 'lib/leftovers/definition_node.rb', line 15 def to_s name.to_s end |