Sha256: 5b4e9bf30467e1beb3b42625e379fd2e9d8ce65d93667ab45609d1f41b5318b6

Contents?: true

Size: 801 Bytes

Versions: 6

Compression:

Stored size: 801 Bytes

Contents

module ActiveRestClient
  class RequestDelegator < Delegator
    def initialize(obj)
      super
      @delegate_obj = obj
    end

    def __getobj__
      @delegate_obj
    end

    def __setobj__(obj)
      @delegate_obj = obj
    end

    def class
      @delegate_obj.class
    end

    def method_missing(name, *args, &block)
      # Handles issue with private method 'test' on base Ruby Object
      return @delegate_obj.test if name.to_sym == :test

      # Forward request to delegate
      @delegate_obj.send(name, *args, &block)
    end

    def kind_of?(obj)
      @delegate_obj.kind_of?(obj)
    end

    def is_a?(obj)
      @delegate_obj.is_a?(obj)
    end

    def instance_of?(obj)
      @delegate_obj.instance_of?(obj)
    end

    def _delegate?
      return true
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
active_rest_client-1.2.0 lib/active_rest_client/request_delegator.rb
active_rest_client-1.1.12 lib/active_rest_client/request_delegator.rb
active_rest_client-1.1.11 lib/active_rest_client/request_delegator.rb
active_rest_client-1.1.10 lib/active_rest_client/request_delegator.rb
active_rest_client-1.1.9 lib/active_rest_client/request_delegator.rb
active_rest_client-1.1.0 lib/active_rest_client/request_delegator.rb