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, #unwrap, #val, #val=, #~
Constructor Details
This class inherits a constructor from Value
Instance Method Details
181
182
183
|
# File 'lib/primitive_wrapper.rb', line 181
def !
!@value
end
|
173
174
175
|
# File 'lib/primitive_wrapper.rb', line 173
def &(other)
@value & other.prim_value
end
|
177
178
179
|
# File 'lib/primitive_wrapper.rb', line 177
def ^(other)
@value ^ other.prim_value
end
|
184
185
186
|
# File 'lib/primitive_wrapper.rb', line 184
def to_i
@value ? 1:0
end
|
187
188
189
|
# File 'lib/primitive_wrapper.rb', line 187
def to_int
Int.new(@value ? 1:0)
end
|
#valid_type(prm) ⇒ Object
162
163
164
165
166
167
168
|
# File 'lib/primitive_wrapper.rb', line 162
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
|
169
170
171
|
# File 'lib/primitive_wrapper.rb', line 169
def |(other)
@value | other.prim_value
end
|