class Zapata::Primitive::Array

Public Instance Methods

node() click to toggle source
# File lib/zapata/primitive/array.rb, line 6
def node
  body = @code
  type = @code.type
  OpenStruct.new(type: type, body: body)
end
to_a() click to toggle source
# File lib/zapata/primitive/array.rb, line 12
def to_a
  value
end
to_raw() click to toggle source
# File lib/zapata/primitive/array.rb, line 16
def to_raw
  value = node.body.to_a.map do |node|
    primitive = Diver.dive(node)
    raw = primitive.to_raw

    if raw.type == :super
      predicted = Predictor::Value.new(raw.value).choose.to_raw
      return_with_super_as_missing(predicted, primitive)
    else
      raw
    end
  end

  Raw.new(:array, value)
end