Method: Whistle::Resource#initialize

Defined in:
lib/resource.rb

#initialize(url) ⇒ Resource

Returns a new instance of Resource.



26
27
28
29
30
31
32
33
34
35
# File 'lib/resource.rb', line 26

def initialize(url)
  @uri = returning URI.parse(url) do |u|
    @username, @password = u.user, u.password
    @username = CGI.unescape(@username) unless @username.blank? # Convert %40 in username to @ (gmail) 
    u.remove_userinfo!
  end
  @url = @uri.to_s
  @store = ($store[@url] ||= {})
  @type = (@store[:type] ||= guess_type) 
end