Class: Cel::Protobuf::Enum

Inherits:
Number show all
Defined in:
lib/cel/ast/elements/protobuf.rb

Constant Summary collapse

MAX_ENUM_INT =

protocol buffer enum fields can accept any signed 32-bit number, values outside that range will raise an error.

(2**31)

Instance Attribute Summary

Attributes inherited from Literal

#type, #value

Instance Method Summary collapse

Methods inherited from Number

#==

Methods inherited from Literal

to_cel_type

Methods included from CelMethods

included

Constructor Details

#initialize(value, enum_type = nil) ⇒ Enum

Returns a new instance of Enum.



445
446
447
448
449
# File 'lib/cel/ast/elements/protobuf.rb', line 445

def initialize(value, enum_type = nil)
  super(:int, value)
  @enum_type = enum_type
  check_overflow(@value)
end

Instance Method Details

#enum_typeObject



451
452
453
# File 'lib/cel/ast/elements/protobuf.rb', line 451

def enum_type
  @enum_type || type
end