Class: Melbourne::AST::Define

Inherits:
ClosedScope show all
Defined in:
lib/melbourne/ast/definitions.rb

Overview

A method definition as in:

def method
end

Direct Known Subclasses

DefineSingletonScope

Instance Attribute Summary collapse

Attributes inherited from ClosedScope

#body

Attributes inherited from Node

#line

Instance Method Summary collapse

Methods inherited from Node

#ascii_graph

Constructor Details

#initialize(line, name, block) ⇒ Define

Returns a new instance of Define.



104
105
106
107
108
109
110
# File 'lib/melbourne/ast/definitions.rb', line 104

def initialize(line, name, block)
  @line = line
  @name = name
  @arguments = block.strip_arguments
  block.array << Nil.new(line) if block.array.empty?
  @body = block
end

Instance Attribute Details

#argumentsObject

The arguments of the defined method



102
103
104
# File 'lib/melbourne/ast/definitions.rb', line 102

def arguments
  @arguments
end

#nameObject

The name of the defined method



98
99
100
# File 'lib/melbourne/ast/definitions.rb', line 98

def name
  @name
end