Sha256: 9d3914394e350c1134a24aa5e9d5869a5cd4905b25f9fa0e0733fc562a784c0b

Contents?: true

Size: 452 Bytes

Versions: 5

Compression:

Stored size: 452 Bytes

Contents

# Generic proxy implementation, based on:
# http://www.binarylogic.com/2009/08/07/how-to-create-a-proxy-class-in-ruby/

module Toaster
  class Proxy

    attr_accessor :target

    def initialize(target)
      @target = target
    end

    instance_methods.each { |m| undef_method m unless m =~ /(^__|^send$|^object_id$|^target)/ }

    protected

    def method_missing(name, *args, &block)
      @target.send(name, *args, &block)
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
cloud-toaster-1.1.6 lib/toaster/util/proxy.rb
cloud-toaster-1.1.5 lib/toaster/util/proxy.rb
cloud-toaster-1.1.4 lib/toaster/util/proxy.rb
cloud-toaster-1.1.3 lib/toaster/util/proxy.rb
cloud-toaster-1.1.2 lib/toaster/util/proxy.rb