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, #type_of?, #unwrap, #val, #val=, #wrapped?, #~
Constructor Details
This class inherits a constructor from Value
Instance Method Details
284
285
286
|
# File 'lib/primitive_wrapper.rb', line 284
def !
!@value
end
|
276
277
278
|
# File 'lib/primitive_wrapper.rb', line 276
def &(other)
@value & other.prim_value
end
|
280
281
282
|
# File 'lib/primitive_wrapper.rb', line 280
def ^(other)
@value ^ other.prim_value
end
|
287
288
289
|
# File 'lib/primitive_wrapper.rb', line 287
def to_i
@value ? 1:0
end
|
290
291
292
|
# File 'lib/primitive_wrapper.rb', line 290
def to_int
Int.new(@value ? 1:0)
end
|
#valid_type(prm) ⇒ Object
265
266
267
268
269
270
271
|
# File 'lib/primitive_wrapper.rb', line 265
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
|
272
273
274
|
# File 'lib/primitive_wrapper.rb', line 272
def |(other)
@value | other.prim_value
end
|