See Zlib::GzipReader documentation for a description.
See Zlib::GzipReader documentation for a description.
See Zlib::GzipReader documentation for a description.
See Zlib::GzipReader documentation for a description.
Returns true if stat is readable by the effective user id of this process.
File.stat("testfile").readable? #=> true
Returns true if stat has its sticky bit set, false if it doesn’t or if the operating system doesn’t support this feature.
File.stat("testfile").sticky? #=> false
Creates a IO::Buffer from the given string’s memory. Without a block a frozen internal copy of the string is created efficiently and used as the buffer source. When a block is provided, the buffer is associated directly with the string’s internal data and updating the buffer will update the string.
Until free is invoked on the buffer, either explicitly or via the garbage collector, the source string will be locked and cannot be modified.
If the string is frozen, it will create a read-only buffer which cannot be modified.
string = 'test' buffer = IO::Buffer.for(string) buffer.external? #=> true buffer.get_string(0, 1) # => "t" string # => "best" buffer.resize(100) # in `resize': Cannot resize external buffer! (IO::Buffer::AccessError) IO::Buffer.for(string) do |buffer| buffer.set_string("T") string # => "Test" end
Short representation of the buffer. It includes the address, size and symbolic flags. This format is subject to change.
puts IO::Buffer.new(4) # uses to_s internally # #<IO::Buffer 0x000055769f41b1a0+4 INTERNAL>
Resizes a buffer to a new_size bytes, preserving its content. Depending on the old and new size, the memory area associated with the buffer might be either extended, or rellocated at different address with content being copied.
buffer = IO::Buffer.new(4) buffer.set_string("test", 0) buffer.resize(8) # resize to 8 bytes # => # #<IO::Buffer 0x0000555f5d1a1630+8 INTERNAL> # 0x00000000 74 65 73 74 00 00 00 00 test....
External buffer (created with ::for), and locked buffer can not be resized.
If the buffer references memory, release it back to the operating system.
for a mapped buffer (e.g. from file): unmap.
for a buffer created from scratch: free memory.
for a buffer created from string: undo the association.
After the buffer is freed, no further operations can’t be performed on it.
buffer = IO::Buffer.for('test') buffer.free # => #<IO::Buffer 0x0000000000000000+0 NULL> buffer.get_value(:U8, 0) # in `get_value': The buffer is not allocated! (IO::Buffer::AllocationError) buffer.get_string # in `get_string': The buffer is not allocated! (IO::Buffer::AllocationError) buffer.null? # => true
You can resize a freed buffer to re-allocate it.
Returns an Array with 14 elements representing the instruction sequence with the following data:
A string identifying the data format. Always YARVInstructionSequence/SimpleDataFormat.
The major version of the instruction sequence.
The minor version of the instruction sequence.
A number identifying the data format. Always 1.
A hash containing:
:arg_sizethe total number of arguments taken by the method or the block (0 if iseq doesn’t represent a method or block)
:local_sizethe number of local variables + 1
:stack_maxused in calculating the stack depth at which a SystemStackError is thrown.
labelThe name of the context (block, method, class, module, etc.) that this instruction sequence belongs to.
<main> if it’s at the top level, <compiled> if it was evaluated from a string.
pathThe relative path to the Ruby file where the instruction sequence was loaded from.
<compiled> if the iseq was evaluated from a string.
absolute_pathThe absolute path to the Ruby file where the instruction sequence was loaded from.
nil if the iseq was evaluated from a string.
first_linenoThe number of the first source line where the instruction sequence was loaded from.
The type of the instruction sequence.
Valid values are :top, :method, :block, :class, :rescue, :ensure, :eval, :main, and plain.
An array containing the names of all arguments and local variables as symbols.
An Hash object containing parameter information.
More info about these values can be found in vm_core.h.
A list of exceptions and control flow operators (rescue, next, redo, break, etc.).
An array of arrays containing the instruction names and operands that make up the body of the instruction sequence.
Note that this format is MRI specific and version dependent.
Returns the contents of this Tms object as a formatted string, according to a format string like that passed to Kernel.format. In addition, format accepts the following extensions:
%uReplaced by the user CPU time, as reported by Tms#utime.
%yReplaced by the system CPU time, as reported by stime (Mnemonic: y of “s*y*stem”)
%UReplaced by the children’s user CPU time, as reported by Tms#cutime
%YReplaced by the children’s system CPU time, as reported by Tms#cstime
%tReplaced by the total CPU time, as reported by Tms#total
%rReplaced by the elapsed real time, as reported by Tms#real
%nReplaced by the label string, as reported by Tms#label (Mnemonic: n of “*n*ame”)
If format is not given, FORMAT is used as default value, detailing the user, system and real elapsed time.
Same as format.
Returns a new 6-element array, consisting of the label, user CPU time, system CPU time, children’s user CPU time, children’s system CPU time and elapsed real time.
Returns a hash containing the same data as ‘to_a`.
Convert the Cookie to its string representation.
Returns the new Hash formed by adding each header-value pair in self as a key-value pair in the Hash.
source = "Name,Value\nfoo,0\nbar,1\nbaz,2\n" table = CSV.parse(source, headers: true) row = table[0] row.to_h # => {"Name"=>"foo", "Value"=>"0"}
Header order is preserved, but repeated headers are ignored:
source = "Name,Name,Name\nFoo,Bar,Baz\n" table = CSV.parse(source, headers: true) row = table[0] row.to_h # => {"Name"=>"Foo"}
Returns the new Array suitable for pattern matching containing the values of the row.
Returns the table as an Array of Arrays; the headers are in the first row:
source = "Name,Value\nfoo,0\nbar,1\nbaz,2\n" table = CSV.parse(source, headers: true) table.to_a # => [["Name", "Value"], ["foo", "0"], ["bar", "1"], ["baz", "2"]]