Methods

URI   open   warn  

External Aliases

open -> open_uri_original_open

Public Instance methods

alias for URI.parse.

This method is introduced at 1.8.2.

[Source]

     # File uri/common.rb, line 603
603:   def URI(uri_str) # :doc:
604:     URI.parse(uri_str)
605:   end

[Source]

     # File soap/soap.rb, line 136
136:     def warn(msg)
137:       STDERR.puts(msg + "\n") unless $VERBOSE.nil?
138:     end

Private Instance methods

makes possible to open various resources including URIs. If the first argument respond to `open’ method, the method is called with the rest arguments.

If the first argument is a string which begins with xxx://, it is parsed by URI.parse. If the parsed object respond to `open’ method, the method is called with the rest arguments.

Otherwise original open is called.

Since open-uri.rb provides URI::HTTP#open, URI::HTTPS#open and URI::FTP#open, Kernel[#.]open can accepts such URIs and strings which begins with http://, https:// and ftp://. In these case, the opened file object is extended by OpenURI::Meta.

[Source]

    # File open-uri.rb, line 80
80:   def open(name, *rest, &block) # :doc:
81:     if name.respond_to?(:open)
82:       name.open(*rest, &block)
83:     elsif name.respond_to?(:to_str) &&
84:           %r{\A[A-Za-z][A-Za-z0-9+\-\.]*://} =~ name &&
85:           (uri = URI.parse(name)).respond_to?(:open)
86:       uri.open(*rest, &block)
87:     else
88:       open_uri_original_open(name, *rest, &block)
89:     end
90:   end

Search

Google

Ruby API Docs

Links