Sets the value for field 'Range'
; see Range request header:
With argument length
:
req = Net::HTTP::Get.new(uri) req.set_range(100) # => 100 req['Range'] # => "bytes=0-99"
With arguments offset
and length
:
req.set_range(100, 100) # => 100...200 req['Range'] # => "bytes=100-199"
With argument range
:
req.set_range(100..199) # => 100..199 req['Range'] # => "bytes=100-199"
Net::HTTPHeader#range=
is an alias for Net::HTTPHeader#set_range
.
Returns a Range
object representing the value of field 'Content-Range'
, or nil
if no such field exists; see Content-Range response header:
res = Net::HTTP.get_response(hostname, '/todos/1') res['Content-Range'] # => nil res['Content-Range'] = 'bytes 0-499/1000' res['Content-Range'] # => "bytes 0-499/1000" res.content_range # => 0..499
Returns the integer representing length of the value of field 'Content-Range'
, or nil
if no such field exists; see Content-Range response header:
res = Net::HTTP.get_response(hostname, '/todos/1') res['Content-Range'] # => nil res['Content-Range'] = 'bytes 0-499/1000' res.range_length # => 500
Create a new ArgumentsNode
node.
Create a new ImaginaryNode
node.
Create a new ParenthesesNode
node.
Create a new ProgramNode
node.
Create a new RangeNode
node.
Create a new RationalNode
node.
Retrieve the value of one of the RangeFlags
flags.
Generate a random binary string.
The argument n specifies the length of the result string.
If n is not specified or is nil, 16 is assumed. It may be larger in future.
The result may contain any byte: “x00” - “xff”.
require 'random/formatter' Random.random_bytes #=> "\xD8\\\xE0\xF4\r\xB2\xFC*WM\xFF\x83\x18\xF45\xB6" # or prng = Random.new prng.random_bytes #=> "m\xDC\xFC/\a\x00Uf\xB2\xB2P\xBD\xFF6S\x97"
Internal interface to Random
; Generate random data n bytes.
Generates formatted random number from raw random bytes. See Random#rand
.
Displays an error statement
to the error output location. Asks a question
if given.
Displays a warning statement
to the warning output location. Asks a question
if given.
Terminates the RubyGems process with the given exit_code
Set
the effective user ID, and if possible, the saved user ID of the process to the given user. Returns the new effective user ID. Not available on all platforms.
[Process.uid, Process.euid] #=> [0, 0] Process::UID.grant_privilege(31) #=> 31 [Process.uid, Process.euid] #=> [0, 31]
Set
the effective group ID, and if possible, the saved group ID of the process to the given group. Returns the new effective group ID. Not available on all platforms.
[Process.gid, Process.egid] #=> [0, 0] Process::GID.grant_privilege(31) #=> 33 [Process.gid, Process.egid] #=> [0, 33]
A block’s parameters.