1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
module Bogus
module FakeObject
# marker for fake objects
end
class Fake
include RecordInteractions
extend RecordInteractions
include FakeObject
extend FakeObject
def initialize(*args)
__shadow__
end
def to_s
"#<#{self.class}:0x#{object_id.to_s(16)}>"
end
def kind_of?(klass)
copied_class = self.class.__copied_class__
super || BaseClassIdentifier.base_class?(copied_class, klass)
end
alias :instance_of? :kind_of?
alias :is_a? :kind_of?
class << self
alias :__create__ :new
def new(*args, &block)
value = __record__(:new, *args, &block)
return value unless ::Bogus::UndefinedReturnValue.undefined?(value)
__create__
end
end
end
end
|