Class: Ruby::Rego::BooleanValue
Overview
Represents a boolean value.
Constant Summary collapse
- TYPE_NAME =
"boolean"
Instance Attribute Summary
Attributes inherited from Value
Instance Method Summary collapse
-
#initialize(value) ⇒ BooleanValue
constructor
Create a boolean value.
-
#truthy? ⇒ Boolean
Determine truthiness.
Methods inherited from Value
#==, #canonical, canonicalize, canonicalize_each, canonicalize_float, #fetch_reference, from_ruby, #hash, #object_key, #to_ruby, #type_name, #undefined?
Constructor Details
#initialize(value) ⇒ BooleanValue
Create a boolean value.
224 225 226 227 228 229 |
# File 'lib/ruby/rego/value.rb', line 224 def initialize(value) klass = value.class raise ArgumentError, "Expected Boolean, got #{klass}" unless [TrueClass, FalseClass].include?(klass) super end |
Instance Method Details
#truthy? ⇒ Boolean
Determine truthiness.
234 235 236 |
# File 'lib/ruby/rego/value.rb', line 234 def truthy? value end |