Handles start_document
events with version
, tag_directives
, and implicit
styling.
Start a document emission with YAML
version
, tags
, and an implicit
start.
Start emitting a sequence with anchor
, a tag
, implicit
sequence start and end, along with style
.
Start emitting a YAML
map with anchor
, tag
, an implicit
start and end, and style
.
Returns the total bytes of the input data to the stream. FIXME
Returns the total bytes of the output data from the stream. FIXME
Returns true
if stat is readable by the real user id of this process.
File.stat("testfile").readable_real? #=> true
If stat is readable by others, returns an integer representing the file permission bits of stat. Returns nil
otherwise. The meaning of the bits is platform dependent; on Unix systems, see stat(2)
.
m = File.stat("/etc/passwd").world_readable? #=> 420 sprintf("%o", m) #=> "644"
Returns true
if stat is writable by the real user id of this process.
File.stat("testfile").writable_real? #=> true
If stat is writable by others, returns an integer representing the file permission bits of stat. Returns nil
otherwise. The meaning of the bits is platform dependent; on Unix systems, see stat(2)
.
m = File.stat("/tmp").world_writable? #=> 511 sprintf("%o", m) #=> "777"
Same as executable?
, but tests using the real owner of the process.
Returns the absolute path of this instruction sequence.
nil
if the iseq was evaluated from a string.
For example, using ::compile_file
:
# /tmp/method.rb def hello puts "hello, world" end # in irb > iseq = RubyVM::InstructionSequence.compile_file('/tmp/method.rb') > iseq.absolute_path #=> /tmp/method.rb
If the access mode is :row
or :col_or_row
, and each argument is either an Integer or a Range, returns rows. Otherwise, returns columns data.
In either case, the returned values are in the order specified by the arguments. Arguments may be repeated.
Returns rows as an Array of CSV::Row objects.
No argument:
source = "Name,Value\nfoo,0\nbar,1\nbaz,2\n" table = CSV.parse(source, headers: true) table.values_at # => []
One index:
values = table.values_at(0) values # => [#<CSV::Row "Name":"foo" "Value":"0">]
Two indexes:
values = table.values_at(2, 0) values # => [#<CSV::Row "Name":"baz" "Value":"2">, #<CSV::Row "Name":"foo" "Value":"0">]
One Range:
values = table.values_at(1..2) values # => [#<CSV::Row "Name":"bar" "Value":"1">, #<CSV::Row "Name":"baz" "Value":"2">]
Ranges and indexes:
values = table.values_at(0..1, 1..2, 0, 2) pp values
Output:
[#<CSV::Row "Name":"foo" "Value":"0">, #<CSV::Row "Name":"bar" "Value":"1">, #<CSV::Row "Name":"bar" "Value":"1">, #<CSV::Row "Name":"baz" "Value":"2">, #<CSV::Row "Name":"foo" "Value":"0">, #<CSV::Row "Name":"baz" "Value":"2">]
Returns columns data as row Arrays, each consisting of the specified columns data for that row:
values = table.values_at('Name') values # => [["foo"], ["bar"], ["baz"]] values = table.values_at('Value', 'Name') values # => [["0", "foo"], ["1", "bar"], ["2", "baz"]]