Class: Melbourne::AST::Module

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

Overview

A module as in:

module M; end

Instance Attribute Summary collapse

Attributes inherited from Node

#line

Instance Method Summary collapse

Methods inherited from Node

#ascii_graph

Constructor Details

#initialize(line, name, body) ⇒ Module

Returns a new instance of Module.



397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
# File 'lib/melbourne/ast/definitions.rb', line 397

def initialize(line, name, body)
  @line = line

  if name.kind_of? Symbol
    @name = ModuleName.new line, name
  else
    @name = ScopedModuleName.new line, name
  end

  if body
    @body = ModuleScope.new line, @name, body
  else
    @body = EmptyBody.new line
  end
end

Instance Attribute Details

#bodyObject

The body of the module



395
396
397
# File 'lib/melbourne/ast/definitions.rb', line 395

def body
  @body
end

#nameObject

The name of the module



391
392
393
# File 'lib/melbourne/ast/definitions.rb', line 391

def name
  @name
end