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
#==, #fetch_reference, from_ruby, #hash, #object_key, #to_ruby, #type_name, #undefined?
Constructor Details
#initialize(value) ⇒ BooleanValue
Create a boolean value.
167 168 169 170 171 172 |
# File 'lib/ruby/rego/value.rb', line 167 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.
177 178 179 |
# File 'lib/ruby/rego/value.rb', line 177 def truthy? value end |