lib/ridley/client.rb in ridley-0.8.5 vs lib/ridley/client.rb in ridley-0.8.6
- old
+ new
@@ -101,12 +101,17 @@
# request options
# @option options [Hash] :ssl
# * :verify (Boolean) [true] set to false to disable SSL verification
# @option options [URI, String, Hash] :proxy
# URI, String, or Hash of HTTP proxy options
+ #
+ # @raise [Errors::ClientKeyFileNotFound] if the option for :client_key does not contain
+ # a file path pointing to a readable client key
def initialize(options = {})
log.info { "Ridley starting..." }
+ super()
+
@options = options.reverse_merge(
ssh: Hash.new
).deep_symbolize_keys
self.class.validate_options(@options)
@@ -125,11 +130,10 @@
unless @options[:client_key].present? && File.exist?(@options[:client_key])
raise Errors::ClientKeyFileNotFound, "client key not found at: '#{@options[:client_key]}'"
end
- super(Celluloid::Registry.new)
pool(Ridley::Connection, size: 4, args: [
@options[:server_url],
@options[:client_name],
@options[:client_key],
@options.slice(*Connection::VALID_OPTIONS)
@@ -225,19 +229,17 @@
instance_eval(&block)
end
alias_method :sync, :evaluate
def finalize
- connection.terminate if connection.alive?
+ connection.terminate if connection && connection.alive?
end
def connection
- registry[:connection_pool]
+ @registry[:connection_pool]
end
private
-
- attr_reader :registry
def method_missing(method, *args, &block)
if block_given?
@self_before_instance_eval ||= eval("self", block.binding)
end