Class: Refract::DefNode

Inherits:
Node
  • Object
show all
Defined in:
lib/refract/nodes/def_node.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Node

#accept, #copy, #start_line, #type, type

Constructor Details

#initialize(prism_node: nil, name:, receiver:, parameters:, body:) ⇒ DefNode

Returns a new instance of DefNode.



5
6
7
8
9
10
11
12
# File 'lib/refract/nodes/def_node.rb', line 5

def initialize(prism_node: nil, name:, receiver:, parameters:, body:)
  @prism_node = prism_node => Prism::Node | nil
  @name = name
  @receiver = receiver
  @parameters = parameters
  @body = body
  freeze
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



14
15
16
# File 'lib/refract/nodes/def_node.rb', line 14

def body
  @body
end

#nameObject

Returns the value of attribute name.



14
15
16
# File 'lib/refract/nodes/def_node.rb', line 14

def name
  @name
end

#parametersObject

Returns the value of attribute parameters.



14
15
16
# File 'lib/refract/nodes/def_node.rb', line 14

def parameters
  @parameters
end

#receiverObject

Returns the value of attribute receiver.



14
15
16
# File 'lib/refract/nodes/def_node.rb', line 14

def receiver
  @receiver
end