Method: UniformResourceIdentifier::UserInfo#initialize

Defined in:
lib/uniform_resource_identifier/user_info.rb

#initialize(user_info = nil) ⇒ UserInfo



8
9
10
11
12
13
14
15
16
17
# File 'lib/uniform_resource_identifier/user_info.rb', line 8

def initialize(=nil)
  if .respond_to?(:to_str) 
    @username, @password = .to_str.split(":")
  elsif .respond_to?(:to_hash)
    .to_hash.symbolize_keys
    @username, @password = .values_at(:username, :password)
  else
    raise(TypeError, "user_info must either be a String or a Hash") unless .nil?
  end
end