Class: Cel::Bool

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

Constant Summary collapse

TRUE_VALUE =
new(true)
FALSE_VALUE =
new(false)

Instance Attribute Summary

Attributes inherited from Literal

#type, #value

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Literal

to_cel_type

Methods included from CelMethods

included

Constructor Details

#initialize(value) ⇒ Bool

Returns a new instance of Bool.



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

def initialize(value)
  super(:bool, value)
end

Class Method Details

.cast(val) ⇒ Object



28
29
30
31
32
# File 'lib/cel/ast/elements/bool.rb', line 28

def self.cast(val)
  return val if val.is_a?(Bool)

  val ? TRUE_VALUE : FALSE_VALUE
end

Instance Method Details

#!Object



21
22
23
# File 'lib/cel/ast/elements/bool.rb', line 21

def !
  Bool.cast(super)
end