Module: Cel

Defined in:
lib/cel.rb,
lib/cel/macro.rb,
lib/cel/errors.rb,
lib/cel/parser.rb,
lib/cel/checker.rb,
lib/cel/context.rb,
lib/cel/program.rb,
lib/cel/version.rb,
lib/cel/protobuf.rb,
lib/cel/ast/types.rb,
lib/cel/environment.rb,
lib/cel/ast/elements.rb

Defined Under Namespace

Modules: Macro, Protobuf, Ruby Classes: BindingError, Bool, Bytes, CheckError, Checker, Condition, Context, Environment, Error, EvaluateError, Group, Identifier, Invoke, List, ListType, Literal, Map, MapType, Message, NoMatchingOverloadError, NoSuchFieldError, Null, Number, Operation, ParseError, Parser, Program, Runner, String, Type

Constant Summary collapse

PRIMITIVE_TYPES =

Primitive Cel Types

i[int uint double bool string bytes list map null_type type].freeze
TYPES =
PRIMITIVE_TYPES.to_h { |typ| [typ, Type.new(typ)] }
LOGICAL_OPERATORS =
%w[< <= >= > == != in].freeze
MULTI_OPERATORS =
%w[* / %].freeze

Class Method Summary collapse

Class Method Details

.to_numeric(anything) ⇒ Object



21
22
23
24
25
26
27
28
# File 'lib/cel.rb', line 21

def self.to_numeric(anything)
  num = BigDecimal(anything.to_s)
  if num.frac.zero?
    num.to_i
  else
    num.to_f
  end
end