Class: Ree::Contracts::ArgContracts::Bool

Inherits:
Object
  • Object
show all
Extended by:
Truncatable
Defined in:
lib/ree/contracts/arg_contracts/bool.rb

Class Method Summary collapse

Methods included from Truncatable

truncate

Class Method Details

.message(value, name, lvl = 1) ⇒ Object



12
13
14
# File 'lib/ree/contracts/arg_contracts/bool.rb', line 12

def self.message(value, name, lvl = 1)
  "expected Bool, got #{value.class} => #{truncate(value.inspect)}"
end

.to_sObject



16
17
18
# File 'lib/ree/contracts/arg_contracts/bool.rb', line 16

def self.to_s
  "Bool"
end

.valid?(value) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
# File 'lib/ree/contracts/arg_contracts/bool.rb', line 8

def self.valid?(value)
  value.is_a?(TrueClass) || value.is_a?(FalseClass)
end