Class: Bit
- Inherits:
-
Bool
show all
- Defined in:
- lib/primitive_wrapper.rb
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_of?, #unwrap, #val, #val=, #wrapped?, #~
Constructor Details
This class inherits a constructor from Value
Instance Method Details
261
262
263
|
# File 'lib/primitive_wrapper.rb', line 261
def !
!@value
end
|
253
254
255
|
# File 'lib/primitive_wrapper.rb', line 253
def &(other)
@value & other.prim_value
end
|
257
258
259
|
# File 'lib/primitive_wrapper.rb', line 257
def ^(other)
@value ^ other.prim_value
end
|
264
265
266
|
# File 'lib/primitive_wrapper.rb', line 264
def to_i
@value ? 1:0
end
|
267
268
269
|
# File 'lib/primitive_wrapper.rb', line 267
def to_int
Int.new(@value ? 1:0)
end
|
#valid_type(prm) ⇒ Object
242
243
244
245
246
247
248
|
# File 'lib/primitive_wrapper.rb', line 242
def valid_type(prm)
return true if prm.kind_of? TrueClass
return true if prm.kind_of? FalseClass
return true if prm.kind_of? NilClass
return true if prm.kind_of? Bool
false
end
|
249
250
251
|
# File 'lib/primitive_wrapper.rb', line 249
def |(other)
@value | other.prim_value
end
|