class Object

Constants

BASE_TEST_DIR

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 39
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