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