Sha256: e8ba35905bbfd1931511e0d01e1e50b8378fd538fd6f3200170b790f1d5b9abb

Contents?: true

Size: 1.02 KB

Versions: 12

Compression:

Stored size: 1.02 KB

Contents

require_relative '../../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

12 entries across 12 versions & 1 rubygems

Version Path
resync-client-0.4.3 lib/resync/client/mixins/client_delegator.rb
resync-client-0.4.2 lib/resync/client/mixins/client_delegator.rb
resync-client-0.4.1 lib/resync/client/mixins/client_delegator.rb
resync-client-0.4.0 lib/resync/client/mixins/client_delegator.rb
resync-client-0.3.5 lib/resync/client/mixins/client_delegator.rb
resync-client-0.3.4 lib/resync/client/mixins/client_delegator.rb
resync-client-0.3.3 lib/resync/client/mixins/client_delegator.rb
resync-client-0.3.2 lib/resync/client/mixins/client_delegator.rb
resync-client-0.3.1 lib/resync/client/mixins/client_delegator.rb
resync-client-0.3.0 lib/resync/client/mixins/client_delegator.rb
resync-client-0.2.5 lib/resync/client/mixins/client_delegator.rb
resync-client-0.2.4 lib/resync/client/mixins/client_delegator.rb