Components of the URI
in the order.
Components of the URI
in the order.
v
Public setter for the password
component (with validation).
See also URI::Generic.check_password
.
require 'uri' uri = URI.parse("http://john:S3nsit1ve@my.example.com") uri.password = "V3ry_S3nsit1ve" uri.to_s #=> "http://john:V3ry_S3nsit1ve@my.example.com"
Returns the password component (without URI
decoding).
v
Public setter for the port component v
(with validation).
See also URI::Generic.check_port
.
require 'uri' uri = URI.parse("http://my.example.com") uri.port = 8080 uri.to_s #=> "http://my.example.com:8080"
v
Public setter for the path component v
(with validation).
See also URI::Generic.check_path
.
require 'uri' uri = URI.parse("http://my.example.com/pub/files") uri.path = "/faq/" uri.to_s #=> "http://my.example.com/faq/"
v
Public setter for the opaque component v
(with validation).
See also URI::Generic.check_opaque
.
Returns true if URI
is hierarchical.
URI
has components listed in order of decreasing significance from left to right, see RFC3986 tools.ietf.org/html/rfc3986 1.2.3.
require 'uri' uri = URI.parse("http://my.example.com/") uri.hierarchical? #=> true uri = URI.parse("mailto:joe@example.com") uri.hierarchical? #=> false
Returns a split URI
against regexp[:ABS_URI]
.
Returns a split URI
against regexp[:ABS_URI]
.
Returns a Hash
(not a DBM
database) created by using each value in the database as a key, with the corresponding key as its value.
Note that all values in the hash will be Strings, but the keys will be actual objects.
Like Process.wait
, but returns a Process::Status
object (instead of an integer pid or nil); see Process.wait
for the values of pid
and flags
.
If there are child processes, waits for a child process to exit and returns a Process::Status
object containing information on that process; sets thread-local variable $?
:
Process.spawn('cat /nop') # => 1155880 Process::Status.wait # => #<Process::Status: pid 1155880 exit 1> $? # => #<Process::Status: pid 1155508 exit 1>
If there is no child process, returns an “empty” Process::Status
object that does not represent an actual process; does not set thread-local variable $?
:
Process::Status.wait # => #<Process::Status: pid -1 exit 0> $? # => #<Process::Status: pid 1155508 exit 1> # Unchanged.
May invoke the scheduler hook Fiber::Scheduler#process_wait
.
Not available on all platforms.
Returns true
if the process exited normally (for example using an exit()
call or finishing the program), false
if not.
Returns the least significant eight bits of the return code of the process if it has exited; nil
otherwise:
`exit 99` $?.exitstatus # => 99
Obtains a lock, runs the block, and releases the lock when the block completes. See the example under Thread::Mutex
.
Releases the lock held in mutex
and waits; reacquires the lock on wakeup.
If timeout
is given, this method returns after timeout
seconds passed, even if no other thread doesn’t signal.
Returns the slept result on mutex
.
Removes all objects from the queue.
Removes all objects from the queue.
Returns maximum backtrace length set by --backtrace-limit
command-line option. The default is -1
which means unlimited backtraces. If the value is zero or positive, the error backtraces, produced by Exception#full_message
, are abbreviated and the extra lines are replaced by ... 3 levels...
$ ruby -r net/http -e "p Thread::Backtrace.limit; Net::HTTP.get(URI('http://wrong.address'))" - 1 .../lib/ruby/3.1.0/socket.rb:227:in `getaddrinfo': Failed to open TCP connection to wrong.address:80 (getaddrinfo: Name or service not known) (SocketError) from .../lib/ruby/3.1.0/socket.rb:227:in `foreach' from .../lib/ruby/3.1.0/socket.rb:632:in `tcp' from .../lib/ruby/3.1.0/net/http.rb:998:in `connect' from .../lib/ruby/3.1.0/net/http.rb:976:in `do_start' from .../lib/ruby/3.1.0/net/http.rb:965:in `start' from .../lib/ruby/3.1.0/net/http.rb:627:in `start' from .../lib/ruby/3.1.0/net/http.rb:503:in `get_response' from .../lib/ruby/3.1.0/net/http.rb:474:in `get' .../lib/ruby/3.1.0/socket.rb:227:in `getaddrinfo': getaddrinfo: Name or service not known (SocketError) from .../lib/ruby/3.1.0/socket.rb:227:in `foreach' from .../lib/ruby/3.1.0/socket.rb:632:in `tcp' from .../lib/ruby/3.1.0/net/http.rb:998:in `connect' from .../lib/ruby/3.1.0/net/http.rb:976:in `do_start' from .../lib/ruby/3.1.0/net/http.rb:965:in `start' from .../lib/ruby/3.1.0/net/http.rb:627:in `start' from .../lib/ruby/3.1.0/net/http.rb:503:in `get_response' from .../lib/ruby/3.1.0/net/http.rb:474:in `get' from -e:1:in `<main>' $ ruby --backtrace-limit 2 -r net/http -e "p Thread::Backtrace.limit; Net::HTTP.get(URI('http://wrong.address'))" 2 .../lib/ruby/3.1.0/socket.rb:227:in `getaddrinfo': Failed to open TCP connection to wrong.address:80 (getaddrinfo: Name or service not known) (SocketError) from .../lib/ruby/3.1.0/socket.rb:227:in `foreach' from .../lib/ruby/3.1.0/socket.rb:632:in `tcp' ... 7 levels... .../lib/ruby/3.1.0/socket.rb:227:in `getaddrinfo': getaddrinfo: Name or service not known (SocketError) from .../lib/ruby/3.1.0/socket.rb:227:in `foreach' from .../lib/ruby/3.1.0/socket.rb:632:in `tcp' ... 7 levels... $ ruby --backtrace-limit 0 -r net/http -e "p Thread::Backtrace.limit; Net::HTTP.get(URI('http://wrong.address'))" 0 .../lib/ruby/3.1.0/socket.rb:227:in `getaddrinfo': Failed to open TCP connection to wrong.address:80 (getaddrinfo: Name or service not known) (SocketError) ... 9 levels... .../lib/ruby/3.1.0/socket.rb:227:in `getaddrinfo': getaddrinfo: Name or service not known (SocketError) ... 9 levels...
Removes all map entries; returns self
.
Returns URL-escaped string following RFC 3986.