Sha256: 492031df83b579a01e22bfe88c5136b805777b983c663627531be5a9ad96f8ce

Contents?: true

Size: 773 Bytes

Versions: 3

Compression:

Stored size: 773 Bytes

Contents

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bogus-0.1.7 lib/bogus/fakes/fake.rb
bogus-0.1.6 lib/bogus/fakes/fake.rb
bogus-0.1.5 lib/bogus/fakes/fake.rb