lib/ridley/connection.rb in ridley-0.5.1 vs lib/ridley/connection.rb in ridley-0.5.2

- old
+ new

@@ -15,10 +15,20 @@ unless missing.empty? missing.collect! { |opt| "'#{opt}'" } raise ArgumentError, "Missing required option(s): #{missing.join(', ')}" end end + + # A hash of default options to be used in the Connection initializer + # + # @return [Hash] + def default_options + { + thread_count: DEFAULT_THREAD_COUNT, + ssh: Hash.new + } + end end extend Forwardable include Ridley::DSL @@ -86,16 +96,17 @@ # @option options [Hash] :ssl # SSL options # @option options [URI, String, Hash] :proxy # URI, String, or Hash of HTTP proxy options def initialize(options = {}) + options = self.class.default_options.merge(options) self.class.validate_options(options) @client_name = options[:client_name] @client_key = File.expand_path(options[:client_key]) @organization = options[:organization] - @thread_count = (options[:thread_count] || DEFAULT_THREAD_COUNT) - @ssh = (options[:ssh] || Hash.new) + @thread_count = options[:thread_count] + @ssh = options[:ssh] @validator_client = options[:validator_client] @validator_path = options[:validator_path] @encrypted_data_bag_secret_path = options[:encrypted_data_bag_secret_path] unless @client_key.present? && File.exist?(@client_key)