Emit a sequence with list
and tag
Emit a sequence with map
and tag
Emit an arbitrary object obj
and tag
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.
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 with the document ends. implicit
is a boolean value indicating whether or not the document has an implicit ending.
Given the following YAML:
--- hello world
implicit
will be true. Given this YAML:
--- hello world ...
implicit
will be false.
Handles start_document
events with version
, tag_directives
, and implicit
styling.
Handles end_document
events with version
, tag_directives
, and implicit
styling.
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”.
Returns true
if this is a header row.
Returns true
if this is a field row.
Returns a duplicate table object, in row mode. This is handy for chaining in a single call without changing the table mode, but be aware that this method can consume a fair amount of memory for bigger data sets.
This method returns the duplicate table for chaining. Don’t chain destructive methods (like []=()) this way though, since you are working with a duplicate.
Switches the mode of this table to row mode. All calls to indexing and iteration methods will work with rows until the mode is changed again.
This method returns the table and is safe to chain.
Gets the body text from the target and outputs it to $stdout. The target can either be specified as (uri
), or as (host
, path
, port
= 80); so:
Net::HTTP.get_print URI('http://www.example.com/index.html')
or:
Net::HTTP.get_print 'www.example.com', '/index.html'
Sets the previous sibling of this child. This can be used to insert a child before some other child.
a = Element.new("a") b = a.add_element("b") c = Element.new("c") b.previous_sibling = c # => <a><b/><c/></a>
Evaluates to the root node of the document that this element belongs to. If this element doesn’t belong to a document, but does belong to another Element
, the parent’s root will be returned, until the earliest ancestor is found.
Note that this is not the same as the document element. In the following example, <a> is the document element, and the root node is the parent node of the document element. You may ask yourself why the root node is useful: consider the doctype and XML
declaration, and any processing instructions before the document element… they are children of the root node, or siblings of the document element. The only time this isn’t true is when an Element
is created that is not part of any Document
. In this case, the ancestor that has no parent acts as the root node.
d = Document.new '<a><b><c/></b></a>' a = d[1] ; c = a[1][1] d.root_node == d # TRUE a.root_node # namely, d c.root_node # again, d
Returns the previous sibling that is an element, or nil if there is no Element
sibling prior to this one
doc = Document.new '<a><b/>text<c/></a>' doc.root.elements['c'].previous_element #-> <b/> doc.root.elements['b'].previous_element #-> nil
Generates a Source
object @param arg Either a String, or an IO
@return a Source
, or nil if a bad argument was given
Reorders an array of nodes so that they are in document order It tries to do this efficiently.
FIXME: I need to get rid of this, but the issue is that most of the XPath
interpreter functions as a filter, which means that we lose context going in and out of function calls. If I knew what the index of the nodes was, I wouldn’t have to do this. Maybe add a document IDX for each node? Problems with mutable documents. Or, rewrite everything.
Creates a socket at address
If address
is multicast address then interface_address
and multicast_interface
can be set as optional.
A created socket is bound to interface_address
. If you use IPv4 multicast then the interface of interface_address
is used as the inbound interface. If interface_address
is omitted or nil then ‘0.0.0.0’ or ‘::1’ is used.
If you use IPv6 multicast then multicast_interface
is used as the inbound interface. multicast_interface
is a network interface index. If multicast_interface
is omitted then 0 (default interface) is used.
Indicated, based on the requested domain, if local gems should be considered.