Class: Zapata::Primitive::Basic

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

Direct Known Subclasses

Const, Ivar, Nil

Instance Attribute Summary

Attributes inherited from Base

#code, #type

Instance Method Summary collapse

Methods inherited from Base

#dive_deeper, #initialize, #name, #return_with_missing_as_super, #return_with_super_as_missing

Constructor Details

This class inherits a constructor from Zapata::Primitive::Base

Instance Method Details

#nodeObject



10
11
12
13
14
# File 'lib/zapata/primitive/basic.rb', line 10

def node
  body = @code
  type = @code.type
  OpenStruct.new(type: type, body: body)
end

#to_aObject



6
7
8
# File 'lib/zapata/primitive/basic.rb', line 6

def to_a
  [value]
end

#to_rawObject



16
17
18
# File 'lib/zapata/primitive/basic.rb', line 16

def to_raw
  Raw.new(node.body.type, node.body.to_a.last)
end