Class: Zapata::Primitive::Arg

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

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



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

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

#to_rawObject



12
13
14
15
# File 'lib/zapata/primitive/arg.rb', line 12

def to_raw
  chosen_value = Predictor::Value.new(node.name, self).choose.to_raw
  return_with_super_as_missing(chosen_value, self)
end