Class: Boolean

Inherits:
Object
  • Object
show all
Defined in:
lib/rxsd/builtin_types.rb

Overview

Ruby doesn’t define a Boolean class, so we define one ourselves

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(val = false) ⇒ Boolean

Returns a new instance of Boolean.



98
99
100
# File 'lib/rxsd/builtin_types.rb', line 98

def initialize(val=false)
   @val = val
end

Class Method Details

.from_s(str) ⇒ Object

Convert string to boolean and return



94
95
96
# File 'lib/rxsd/builtin_types.rb', line 94

def self.from_s(str)
   str.to_b
end

Instance Method Details

#nil?Boolean

Returns:



102
103
104
# File 'lib/rxsd/builtin_types.rb', line 102

def nil?
   return !@val
end