Sha256: 1ca083dd5c6fe887a49982df5195f5614704ecb283eb3a286ab6c4419b4e3d8a

Contents?: true

Size: 728 Bytes

Versions: 3

Compression:

Stored size: 728 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)
      klass == self.class.__copied_class__
    end

    def instance_of?(klass)
      klass == self.class.__copied_class__
    end

    class << self
      alias :__create__ :new

      def new(*args, &block)
        __record__(:new, *args, &block)
        __create__
      end

      def name
        __copied_class__.name
      end

      def to_s
        name
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bogus-0.1.3 lib/bogus/fake.rb
bogus-0.1.2 lib/bogus/fake.rb
bogus-0.1.1 lib/bogus/fake.rb