Initialize instance variables for available options

This commit is contained in:
Wojciech Piekutowski 2011-02-20 16:12:30 +01:00
parent 2644d2b27d
commit e4867b542e

View File

@ -142,7 +142,11 @@ module Mongo
# This method uses the lambdas defined in OPT_VALID and OPT_CONV to validate
# and convert the given options.
def parse_options(opts)
# initialize instance variables for available options
OPT_VALID.keys.each { |k| instance_variable_set("@#{k}", nil) }
return unless opts
separator = opts.include?('&') ? '&' : ';'
opts.split(separator).each do |attr|
key, value = attr.split('=')