Class: Ruby::Rego::AST::ObjectLiteral

Inherits:
Base
  • Object
show all
Defined in:
lib/ruby/rego/ast/composite.rb

Overview

Represents an object literal.

Instance Attribute Summary collapse

Attributes inherited from Base

#location

Instance Method Summary collapse

Methods inherited from Base

#==, #accept, #deconstruct_keys, #eql?, format_value, #hash, #to_s

Constructor Details

#initialize(pairs:, location: nil) ⇒ ObjectLiteral

Returns a new instance of ObjectLiteral.

Parameters:

  • pairs (Array<Array(Object, Object)>)
  • location (Location, nil) (defaults to: nil)


25
26
27
28
# File 'lib/ruby/rego/ast/composite.rb', line 25

def initialize(pairs:, location: nil)
  super(location: location)
  @pairs = pairs.map { |pair| pair.dup.freeze }.freeze
end

Instance Attribute Details

#pairsArray<Array(Object, Object)> (readonly)

Returns:

  • (Array<Array(Object, Object)>)


31
32
33
# File 'lib/ruby/rego/ast/composite.rb', line 31

def pairs
  @pairs
end