| Module | Kernel |
| In: |
uri/common.rb
soap/soap.rb yaml.rb pp.rb open-uri.rb |
External Aliases
| open | -> | open_uri_original_open |
Public Instance methods
# 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.
# 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