Class: Mingle::MingleBoolean

Inherits:
MingleValue
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/mingle.rb

Constant Summary collapse

TRUE =
new( true )
FALSE =
new( false )

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(b) ⇒ MingleBoolean

Returns a new instance of MingleBoolean.



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

def initialize( b )
    @b = b
end

Class Method Details

.for_boolean(b) ⇒ Object



128
129
130
# File 'lib/mingle.rb', line 128

def self.for_boolean( b )
    b ? TRUE : FALSE
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



118
119
120
# File 'lib/mingle.rb', line 118

def ==( other )
    other.is_a?( MingleBoolean ) && @b == other.as_boolean
end

#as_booleanObject Also known as: to_b, to_bool, to_boolean



109
110
111
# File 'lib/mingle.rb', line 109

def as_boolean
    @b
end

#inspectObject



104
105
106
# File 'lib/mingle.rb', line 104

def inspect
    to_s.inspect
end

#to_sObject



99
100
101
# File 'lib/mingle.rb', line 99

def to_s
    @b.to_s
end