Class: Ruby::Rego::NumberValue

Inherits:
Value
  • Object
show all
Defined in:
lib/ruby/rego/value.rb

Overview

Represents a numeric value.

Constant Summary collapse

TYPE_NAME =
"number"

Instance Attribute Summary

Attributes inherited from Value

#value

Instance Method Summary collapse

Methods inherited from Value

#==, #fetch_reference, from_ruby, #hash, #object_key, #to_ruby, #truthy?, #type_name, #undefined?

Constructor Details

#initialize(value) ⇒ NumberValue

Create a numeric value.

Parameters:

  • value (Numeric)

    numeric value

Raises:

  • (ArgumentError)


153
154
155
156
157
# File 'lib/ruby/rego/value.rb', line 153

def initialize(value)
  raise ArgumentError, "Expected Numeric, got #{value.class}" unless value.is_a?(Numeric)

  super
end