class Object
Constants
- FIDDLE_FREEZE_BIT
Public Instance Methods
boolean_check(obj)
click to toggle source
Raises an ArgumentError unless the object is truthy.
# File lib/gosling/utils.rb, line 18 def boolean_check(obj) raise ArgumentError.new("Expected true or false, but received #{obj.inspect}!") unless [true, false].include?(obj) end
type_check(obj, type)
click to toggle source
Raises an ArgumentError unless the object is of the specified type.
# File lib/gosling/utils.rb, line 4 def type_check(obj, type) raise ArgumentError.new("Expected #{type}, but received #{obj.inspect}!") unless obj.is_a?(type) end
types_check(obj, *types)
click to toggle source
Raises an ArgumentError unless the object is one of the listed types.
# File lib/gosling/utils.rb, line 11 def types_check(obj, *types) raise ArgumentError.new("Expected one of #{types.inspect}, but received #{obj.inspect}!") unless types.any? { |type| obj.is_a?(type) } end
unfreeze()
click to toggle source
# File lib/gosling/object_cache.rb, line 6 def unfreeze ptr = @fiddle_pointer || Fiddle::Pointer.new(object_id * 2) ptr[1] &= FIDDLE_FREEZE_BIT @fiddle_pointer = ptr end