Sha256: 3dfb7ef62ac02e37329cb053591d49efddfaf4a771d467cb6974ad0ef4baa250

Contents?: true

Size: 1.01 KB

Versions: 4

Compression:

Stored size: 1.01 KB

Contents

require 'resync/client'

module Resync
  class Client
    module Mixins
      # An object that delegates to another to provide a {Client} for downloading
      # resources and links.
      #
      # @!attribute [rw] client_delegate
      #   @return [#client] The client provider.
      module ClientDelegator
        attr_accessor :client_delegate

        def client
          client_delegate.client
        end

        # Creates a one-off delegate wrapper around the specified {Client}
        # @param value [Client] the client
        def client=(value)
          @client_delegate = ClientDelegate.new(value)
        end

        # Minimal 'delegate' wrapper around a specified {Client}
        class ClientDelegate
          # @return [#client] the client
          attr_reader :client

          # Creates a new {ClientDelegate} wrapping the specified {Client}
          # @param client The client to delegate to
          def initialize(client)
            @client = client
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
resync-client-0.4.7 lib/resync/client/mixins/client_delegator.rb
resync-client-0.4.6 lib/resync/client/mixins/client_delegator.rb
resync-client-0.4.5 lib/resync/client/mixins/client_delegator.rb
resync-client-0.4.4 lib/resync/client/mixins/client_delegator.rb