Returns a URL-encoded string derived from the given string str
.
The returned string:
Preserves:
Characters '*'
, '.'
, '-'
, and '_'
.
Character in ranges 'a'..'z'
, 'A'..'Z'
, and '0'..'9'
.
Example:
URI.encode_www_form_component('*.-_azAZ09') # => "*.-_azAZ09"
Converts:
Character ' '
to character '+'
.
Any other character to “percent notation”; the percent notation for character c is '%%%X' % c.ord
.
Example:
URI.encode_www_form_component('Here are some punctuation characters: ,;?:') # => "Here+are+some+punctuation+characters%3A+%2C%3B%3F%3A"
Encoding:
If str
has encoding Encoding::ASCII_8BIT, argument enc
is ignored.
Otherwise str
is converted first to Encoding::UTF_8 (with suitable character replacements), and then to encoding enc
.
In either case, the returned string has forced encoding Encoding::US_ASCII.
Related: URI.encode_uri_component
(encodes ' '
as '%20'
).
Returns a string decoded from the given URL-encoded string str
.
The given string is first encoded as Encoding::ASCII-8BIT (using String#b
), then decoded (as below), and finally force-encoded to the given encoding enc
.
The returned string:
Preserves:
Characters '*'
, '.'
, '-'
, and '_'
.
Character in ranges 'a'..'z'
, 'A'..'Z'
, and '0'..'9'
.
Example:
URI.decode_www_form_component('*.-_azAZ09') # => "*.-_azAZ09"
Converts:
Character '+'
to character ' '
.
Each “percent notation” to an ASCII character.
Example:
URI.decode_www_form_component('Here+are+some+punctuation+characters%3A+%2C%3B%3F%3A') # => "Here are some punctuation characters: ,;?:"
Related: URI.decode_uri_component
(preserves '+'
).
SecHandle struct
Creates binary representations of a SecBufferDesc structure, including the SecBuffer contained inside.
Enumerator::ArithmeticSequence
is a subclass of Enumerator
, that is a representation of sequences of numbers with common difference. Instances of this class can be generated by the Range#step
and Numeric#step
methods.
The class can be used for slicing Array
(see Array#slice
) or custom collections.
An FFI closure wrapper, for handling callbacks.
closure = Class.new(Fiddle::Closure) { def call 10 end }.new(Fiddle::TYPE_INT, []) #=> #<#<Class:0x0000000150d308>:0x0000000150d240> func = Fiddle::Function.new(closure, [], Fiddle::TYPE_INT) #=> #<Fiddle::Function:0x00000001516e58> func.call #=> 10
FIXME: This isn’t documented in Nutshell.
Since MonitorMixin.new_cond
returns a ConditionVariable
, and the example above calls while_wait and signal, this class should be documented.
UDP/IP address information used by Socket.udp_server_loop
.
Zlib::GzipWriter
is a class for writing gzipped files. GzipWriter
should be used with an instance of IO
, or IO-like, object.
Following two example generate the same result.
Zlib::GzipWriter.open('hoge.gz') do |gz| gz.write 'jugemu jugemu gokou no surikire...' end File.open('hoge.gz', 'w') do |f| gz = Zlib::GzipWriter.new(f) gz.write 'jugemu jugemu gokou no surikire...' gz.close end
To make like gzip(1) does, run following:
orig = 'hoge.txt' Zlib::GzipWriter.open('hoge.gz') do |gz| gz.mtime = File.mtime(orig) gz.orig_name = orig gz.write IO.binread(orig) end
NOTE: Due to the limitation of Ruby’s finalizer, you must explicitly close GzipWriter
objects by Zlib::GzipWriter#close
etc. Otherwise, GzipWriter
will be not able to write the gzip footer and will generate a broken gzip file.
exception to wait for writing by EAGAIN. see IO.select
.
exception to wait for writing by EWOULDBLOCK. see IO.select
.
exception to wait for writing by EINPROGRESS. see IO.select
.
Note: Don’t use this class directly. This is an internal class.
Timer id conversion keeps objects alive for a certain amount of time after their last access. The default time period is 600 seconds and can be changed upon initialization.
To use TimerIdConv:
DRb.install_id_conv TimerIdConv.new 60 # one minute
A custom InputMethod class used by XMP
for evaluating string io.
HTTPGenericRequest is the parent of the Net::HTTPRequest
class.
Do not use this directly; instead, use a subclass of Net::HTTPRequest
.
Response class for Non-Authoritative Information
responses (status code 203).
The Non-Authoritative Information
response indicates that the server is a transforming proxy (such as a Web accelerator) that received a 200 OK response from its origin, and is returning a modified version of the origin’s response.
References:
Response class for Found
responses (status code 302).
The Found
response indicates that the client should look at (browse to) another URL.
References:
Response class for Unauthorized
responses (status code 401).
Authentication is required, but either was not provided or failed.
References: