Sha256: 2d9d031e6acdf4e3227955b56aa21176df912771950dd9f7b5ae9e8a36bd077a

Contents?: true

Size: 776 Bytes

Versions: 12

Compression:

Stored size: 776 Bytes

Contents

module Bogus
  class ProxyClass < Module
    def initialize(fake_name, klass, create_recording_proxy)
      @fake_name = fake_name
      @klass = klass
      @create_recording_proxy = create_recording_proxy

      @recording_proxy = @create_recording_proxy.call(@klass, @fake_name)
    end

    def self.create(fake_name, klass, create_recording_proxy)
    end

    def new(*args, &block)
      instance = @klass.new(*args, &block)
      @create_recording_proxy.call(instance, @fake_name)
    end

    def method_missing(name, *args, &block)
      @recording_proxy.__send__(name, *args, &block)
    end

    def const_missing(name)
      @recording_proxy.__send__(:const_get, name)
    end

    def respond_to?(name)
      @recording_proxy.respond_to?(name)
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
bogus-0.1.7 lib/bogus/contracts/proxy_class.rb
bogus-0.1.6 lib/bogus/contracts/proxy_class.rb
bogus-0.1.5 lib/bogus/contracts/proxy_class.rb
bogus-0.1.4 lib/bogus/contracts/proxy_class.rb
bogus-0.1.3 lib/bogus/proxy_class.rb
bogus-0.1.2 lib/bogus/proxy_class.rb
bogus-0.1.1 lib/bogus/proxy_class.rb
bogus-0.1.0 lib/bogus/proxy_class.rb
bogus-0.0.4 lib/bogus/proxy_class.rb
bogus-0.0.3 lib/bogus/proxy_class.rb
bogus-0.0.3.rc.2 lib/bogus/proxy_class.rb
bogus-0.0.3.rc.1 lib/bogus/proxy_class.rb