def initialize(options={})
if options.has_key?(:authority)
if (options.keys & [:userinfo, :user, :password, :host, :port]).any?
raise ArgumentError,
"Cannot specify both an authority and any of the components " +
"within the authority."
end
end
if options.has_key?(:userinfo)
if (options.keys & [:user, :password]).any?
raise ArgumentError,
"Cannot specify both a userinfo and either the user or password."
end
end
self.validation_deferred = true
self.scheme = options[:scheme] if options[:scheme]
self.user = options[:user] if options[:user]
self.password = options[:password] if options[:password]
self.userinfo = options[:userinfo] if options[:userinfo]
self.host = options[:host] if options[:host]
self.port = options[:port] if options[:port]
self.authority = options[:authority] if options[:authority]
self.path = options[:path] if options[:path]
self.query = options[:query] if options[:query]
self.fragment = options[:fragment] if options[:fragment]
self.validation_deferred = false
end