class Object
Constants
- BASE_TEST_DIR
- TIMES
Public Class Methods
address_from_id(id)
click to toggle source
Converts the object_id of a non-immediate object to its memory address
# File lib/utilrb/object/address.rb, line 9 def self.address_from_id(id) id = 0xFFFFFFFFFFFFFFFF - ~id if id < 0 (id * 2) & 0xFFFFFFFFFFFFFFFF end
Public Instance Methods
+(other_enumerator)
click to toggle source
Builds a sequence of enumeration object.
([1, 2].enum_for + [2, 3].enum_for).to_a # => [1, 2, 2, 3]
# File lib/utilrb/enumerable/sequence.rb, line 32 def +(other_enumerator) # :nodoc SequenceEnumerator.new << self << other_enumerator end
address()
click to toggle source
Return the object address (for non immediate objects).
# File lib/utilrb/object/address.rb, line 5 def address; Object.address_from_id(object_id) end
class_attribute(attr_def, &init)
click to toggle source
Like attribute, but on the singleton class of this object
# File lib/utilrb/object/attribute.rb, line 41 def class_attribute(attr_def, &init) singleton_class.class_eval { attribute(attr_def, &init) } end
enum_uniq(enum_with = :each, *args, &filter)
click to toggle source
Enumerate using the each(*args) method, removing the duplicate
entries. If filter is given, it should return an object the
enumerator will compare for equality (instead of using the objects
themselves)
# File lib/utilrb/enumerable/uniq.rb, line 46 def enum_uniq(enum_with = :each, *args, &filter) UniqEnumerator.new(self, enum_with, args, filter) end
scoped_eval(type = :instance_eval, &b)
click to toggle source
# File lib/utilrb/object/scoped_eval.rb, line 4 def scoped_eval(type = :instance_eval, &b) send(type, &b) end
validate(options)
click to toggle source
# File benchmarks/validate_options.rb, line 10 def validate(options) Kernel.validate_options options, :accept_opaques => false, :accept_pointers => false, :merge_skip_copy => true, :remove_trailing_skips => true end
validate_with_keyword_arguments(accept_opaques: false, accept_pointers: false, merge_skip_copy: true, remove_trailing_skips: true)
click to toggle source
# File benchmarks/validate_options.rb, line 24 def validate_with_keyword_arguments(accept_opaques: false, accept_pointers: false, merge_skip_copy: true, remove_trailing_skips: true) Hash[accept_opaques: accept_opaques, accept_pointers: accept_pointers, merge_skip_copy: merge_skip_copy, remove_trailing_skips: remove_trailing_skips] end
validate_with_new_style_hash(options)
click to toggle source
# File benchmarks/validate_options.rb, line 17 def validate_with_new_style_hash(options) Kernel.validate_options options, accept_opaques: false, accept_pointers: false, merge_skip_copy: true, remove_trailing_skips: true end