Class: Bool
Direct Known Subclasses
Bit
Instance Method Summary
collapse
Methods inherited from Value
#!=, #==, #ensure_valid, #freeze, freeze_raise?, ignore_on_freeze, #initialize, #inspect, #prim_value, raise_on_freeze, #replace, #to_s, #to_wrapper, #type, #type_of?, #unwrap, #val, #val=, #wrapped?, #~
Constructor Details
This class inherits a constructor from Value
Instance Method Details
252
253
254
|
# File 'lib/primitive_wrapper.rb', line 252
def !
Bool.new(!@value)
end
|
244
245
246
|
# File 'lib/primitive_wrapper.rb', line 244
def &(other)
Bool.new(@value & other.prim_value)
end
|
248
249
250
|
# File 'lib/primitive_wrapper.rb', line 248
def ^(other)
Bool.new(@value ^ other.prim_value)
end
|
256
257
258
|
# File 'lib/primitive_wrapper.rb', line 256
def to_i
@value ? 1:0
end
|
259
260
261
|
# File 'lib/primitive_wrapper.rb', line 259
def to_int
Int.new(@value ? 1:0)
end
|
#valid_type(prm) ⇒ Object
231
232
233
234
235
236
237
238
|
# File 'lib/primitive_wrapper.rb', line 231
def valid_type(prm)
return true if prm.kind_of? TrueClass
return true if prm.kind_of? FalseClass
return true if prm.kind_of? TrueW
return true if prm.kind_of? FalseW
return true if prm.kind_of? Bool
false
end
|
240
241
242
|
# File 'lib/primitive_wrapper.rb', line 240
def |(other)
Bool.new(@value | other.prim_value)
end
|