Class: Rubinius::AST::DefineSingleton

Inherits:
Node
  • Object
show all
Defined in:
lib/compiler/ast/definitions.rb

Instance Attribute Summary collapse

Attributes inherited from Node

#line

Instance Method Summary collapse

Methods inherited from Node

#ascii_graph, #attributes, #children, match_arguments?, match_send?, #new_block_generator, #new_generator, #node_name, node_name, #pos, #set_child, transform, #transform, transform_comment, transform_kind, transform_kind=, transform_name, #visit, #walk

Constructor Details

#initialize(line, receiver, name, block) ⇒ DefineSingleton

Returns a new instance of DefineSingleton.



136
137
138
139
140
# File 'lib/compiler/ast/definitions.rb', line 136

def initialize(line, receiver, name, block)
  @line = line
  @receiver = receiver
  @body = DefineSingletonScope.new line, name, block
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



134
135
136
# File 'lib/compiler/ast/definitions.rb', line 134

def body
  @body
end

#receiverObject

Returns the value of attribute receiver.



134
135
136
# File 'lib/compiler/ast/definitions.rb', line 134

def receiver
  @receiver
end

Instance Method Details

#to_sexpObject



142
143
144
145
# File 'lib/compiler/ast/definitions.rb', line 142

def to_sexp
  [:defs, @receiver.to_sexp, @body.name,
    @body.arguments.to_sexp, [:scope, @body.body.to_sexp]]
end