Handles start_document
events with version
, tag_directives
, and implicit
styling.
Handles end_document
events with version
, tag_directives
, and implicit
styling.
Start a document emission with YAML
version
, tags
, and an implicit
start.
End a document emission with an implicit
ending.
This method is called when a parse error is found.
ERROR_TOKEN_ID is an internal ID of token which caused error. You can get string representation of this ID by calling token_to_str
.
ERROR_VALUE is a value of error token.
value_stack is a stack of symbol values. DO NOT MODIFY this object.
This method raises ParseError
by default.
If this method returns, parsers enter “error recovering mode”.
Replace %w+% into the environment value of what is contained between the %‘s This method is used for REG_EXPAND_SZ.
For detail, see expandEnvironmentStrings Win32 API.
Returns true
if this is a header row, false
otherwise.
Returns true
if this is a field row, false
otherwise.
Returns a duplicate of self
, in row mode (see Row Mode):
source = "Name,Value\nfoo,0\nbar,1\nbaz,2\n" table = CSV.parse(source, headers: true) table.mode # => :col_or_row dup_table = table.by_row dup_table.mode # => :row dup_table.equal?(table) # => false # It's a dup
This may be used to chain method calls without changing the mode (but also will affect performance and memory usage):
dup_table.by_row[1]
Also note that changes to the duplicate table will not affect the original.
Sets the mode for self
to row mode (see Row Mode); returns self
:
source = "Name,Value\nfoo,0\nbar,1\nbaz,2\n" table = CSV.parse(source, headers: true) table.mode # => :col_or_row table1 = table.by_row! table.mode # => :row table1.equal?(table) # => true # Returned self