Sha256: fdad6c6dfa654896e7f0230113937b5fbe91b8882eaaf168b802fd637546944b

Contents?: true

Size: 1.29 KB

Versions: 3

Compression:

Stored size: 1.29 KB

Contents

require 'drb/drb'
module Shhh
  module App
    module Password
      module Cache
        class Client
          # The URI to connect to

          attr_accessor :uri, :host, :port
          attr_accessor :config

          def initialize(host: nil,
                         port: nil,
                         config: {})
            self.config =config
            self.host   = host
            self.port   = port
          end

          def uri
            return uri if uri
            template = 'druby://<%= host %>:<%= port %>>'
            renderer = ERB.new template
            self.uri = renderer.result(binding)
          end

          def start
            raise NoMethodError, 'not implemented'
            # Start a local DRbServer to handle callbacks.

            # Not necessary for this small example, but will be required
            # as soon as we pass a non-marshallable object as an argument
            # to a dRuby call.

            # Note: this must be called at least once per process to take any effect.
            # This is particularly important if your application forks.
            DRb.start_service
            # timeserver = DRbObject.new_with_uri(SERVER_URI)
            # puts timeserver.get_current_time
            # sleep 10
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
shhh-1.6.3 lib/shhh/app/password/cache/client.rb
shhh-1.6.2 lib/shhh/app/password/cache/client.rb
shhh-1.6.1 lib/shhh/app/password/cache/client.rb