Class: Ruby::Rego::AST::ArrayComprehension

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

Overview

Represents an array comprehension.

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(term:, body:, location: nil) ⇒ ArrayComprehension

Returns a new instance of ArrayComprehension.

Parameters:

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


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

def initialize(term:, body:, location: nil)
  super(location: location)
  @term = term
  @body = body.dup.freeze
end

Instance Attribute Details

#bodyObject (readonly)

Returns:

  • (Object)


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

def body
  @body
end

#termObject (readonly)

Returns:

  • (Object)


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

def term
  @term
end