Class: Ruby::Rego::AST::Reference

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

Overview

Represents a reference to nested data (e.g. input.user.roles[0]).

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(base:, path:, location: nil) ⇒ Reference

Returns a new instance of Reference.

Parameters:

  • base (Object)
  • path (Array<RefArg>)
  • location (Location, nil) (defaults to: nil)


13
14
15
16
17
# File 'lib/ruby/rego/ast/reference.rb', line 13

def initialize(base:, path:, location: nil)
  super(location: location)
  @base = base
  @path = path.dup.freeze
end

Instance Attribute Details

#baseObject (readonly)

Returns:

  • (Object)


20
21
22
# File 'lib/ruby/rego/ast/reference.rb', line 20

def base
  @base
end

#pathArray<RefArg> (readonly)

Returns:



23
24
25
# File 'lib/ruby/rego/ast/reference.rb', line 23

def path
  @path
end