Class: NRSER::Types::BooleanType

Inherits:
Is show all
Defined in:
lib/nrser/types/booleans.rb

Overview

Abstract base class for TrueType and FalseType.

Direct Known Subclasses

FalseType, TrueType

Instance Attribute Summary

Attributes inherited from Is

#value

Instance Method Summary collapse

Methods inherited from Is

#==, #explain, #test?

Methods inherited from Type

#===, #builtin_inspect, #check, #check!, #explain, #from_data, #from_s, #has_from_data?, #has_from_s?, #has_to_data?, #inspect, #intersection, #name, #not, #respond_to?, #test, #test?, #to_data, #to_s, #union, #xor

Constructor Details

#initialize(value, **options) ⇒ BooleanType

Instantiate a new ‘BooleanType`.



20
21
22
23
24
25
26
27
28
# File 'lib/nrser/types/booleans.rb', line 20

def initialize value, **options
  # Check it's a boolean
  unless true.equal?( value ) || false.equal?( value )
    raise ArgumentError.new \
      "`value` arg must be `true` or `false`, found #{ value.inspect }"
  end
  
  super value, **options
end