Results for: "tally"

Called with encoding when the YAML stream starts. This method is called once per stream. A stream may contain multiple documents.

See the constants in Psych::Parser for the possible values of encoding.

Called when the document starts with the declared version, tag_directives, if the document is implicit.

version will be an array of integers indicating the YAML version being dealt with, tag_directives is a list of tuples indicating the prefix and suffix of each tag, and implicit is a boolean indicating whether the document is started implicitly.

Example

Given the following YAML:

%YAML 1.1
%TAG ! tag:tenderlovemaking.com,2009:
--- !squee

The parameters for start_document must be this:

version         # => [1, 1]
tag_directives  # => [["!", "tag:tenderlovemaking.com,2009:"]]
implicit        # => false

Called when a sequence is started.

anchor is the anchor associated with the sequence or nil. tag is the tag associated with the sequence or nil. implicit a boolean indicating whether or not the sequence was implicitly started. style is an integer indicating the list style.

See the constants in Psych::Nodes::Sequence for the possible values of style.

Example

Here is a YAML document that exercises most of the possible ways this method can be called:

---
- !!seq [
  a
]
- &pewpew
  - b

The above YAML document consists of three lists, an outer list that contains two inner lists. Here is a matrix of the parameters sent to represent these lists:

# anchor    tag                       implicit  style
[nil,       nil,                      true,     1     ]
[nil,       "tag:yaml.org,2002:seq",  false,    2     ]
["pewpew",  nil,                      true,     1     ]

Called when a map starts.

anchor is the anchor associated with the map or nil. tag is the tag associated with the map or nil. implicit is a boolean indicating whether or not the map was implicitly started. style is an integer indicating the mapping style.

See the constants in Psych::Nodes::Mapping for the possible values of style.

Example

Here is a YAML document that exercises most of the possible ways this method can be called:

---
k: !!map { hello: world }
v: &pewpew
  hello: world

The above YAML document consists of three maps, an outer map that contains two inner maps. Below is a matrix of the parameters sent in order to represent these three maps:

# anchor    tag                       implicit  style
[nil,       nil,                      true,     1     ]
[nil,       "tag:yaml.org,2002:map",  false,    2     ]
["pewpew",  nil,                      true,     1     ]

Handles start_document events with version, tag_directives, and implicit styling.

See Psych::Handler#start_document

No documentation available

Start a stream emission with encoding

See Psych::Handler#start_stream

Start a document emission with YAML version, tags, and an implicit start.

See Psych::Handler#start_document

Start emitting a sequence with anchor, a tag, implicit sequence start and end, along with style.

See Psych::Handler#start_sequence

Start emitting a YAML map with anchor, tag, an implicit start and end, and style.

See Psych::Handler#start_mapping

common

Enumerate values.

Delete a registry value named name. We can not delete the ‘default’ value.

Guesses the type of the data which have been inputed into the stream. The returned value is either BINARY, ASCII, or UNKNOWN.

Duplicates the deflate stream.

See Zlib::GzipReader documentation for a description.

Returns true if stat is readable by the real user id of this process.

File.stat("testfile").readable_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"

Iterates over keys and objects in a weakly referenced object

No documentation available
No documentation available
No documentation available
No documentation available
No documentation available

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"]]
Search took: 2ms  ·  Total Results: 1166