Class: Zapata::Primitive::Modul

Inherits:
Base
  • Object
show all
Defined in:
lib/zapata/primitive/modul.rb

Instance Attribute Summary

Attributes inherited from Base

#code, #type

Instance Method Summary collapse

Methods inherited from Base

#dive_deeper, #name, #return_with_missing_as_super, #return_with_super_as_missing, #to_raw

Constructor Details

#initialize(code) ⇒ Modul

Returns a new instance of Modul.



6
7
8
9
10
11
# File 'lib/zapata/primitive/modul.rb', line 6

def initialize(code)
  @code = code
  Diver.current_moduls << self
  dive_deeper
  Diver.current_moduls.pop
end

Instance Method Details

#nodeObject



13
14
15
16
17
18
19
# File 'lib/zapata/primitive/modul.rb', line 13

def node
  const, body = @code.to_a
  modul, name = const.to_a
  type = @code.type

  OpenStruct.new(type: type, modul: modul, name: name, body: body)
end