Class: Cel::Condition

Inherits:
Object
  • Object
show all
Defined in:
lib/cel/ast/elements/condition.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(if_, then_, else_, depth: 1) ⇒ Condition

Returns a new instance of Condition.



7
8
9
10
11
12
# File 'lib/cel/ast/elements/condition.rb', line 7

def initialize(if_, then_, else_, depth: 1)
  @if = if_
  @then = then_
  @else = else_
  @depth = depth
end

Instance Attribute Details

#depthObject (readonly)

Returns the value of attribute depth.



5
6
7
# File 'lib/cel/ast/elements/condition.rb', line 5

def depth
  @depth
end

#elseObject (readonly)

Returns the value of attribute else.



5
6
7
# File 'lib/cel/ast/elements/condition.rb', line 5

def else
  @else
end

#ifObject (readonly)

Returns the value of attribute if.



5
6
7
# File 'lib/cel/ast/elements/condition.rb', line 5

def if
  @if
end

#thenObject (readonly)

Returns the value of attribute then.



5
6
7
# File 'lib/cel/ast/elements/condition.rb', line 5

def then
  @then
end

Instance Method Details

#==(other) ⇒ Object



18
19
20
# File 'lib/cel/ast/elements/condition.rb', line 18

def ==(other)
  other.is_a?(Condition) && @if == other.if && @then == other.then && @else == other.else
end

#typeObject



14
15
16
# File 'lib/cel/ast/elements/condition.rb', line 14

def type
  TYPES[:any]
end