Iterates over each attribute of an Element
, yielding the expanded name and value as a pair of Strings.
doc = Document.new '<a x="1" y="2"/>' doc.root.attributes.each {|name, value| p name+" => "+value }
Evaluates whether the given string matches an entity definition, returning true if so, and false otherwise.
Enumerates rows of the Enumerable
objects.
check for illegal characters
Iterates over nodes that match the given path, calling the supplied block with the match.
The context element
The xpath to search for. If not supplied or nil, defaults to ‘*’
If supplied, a Hash
which defines a namespace mapping
If supplied, a Hash
which maps $variables in the query to values. This can be used to avoid XPath
injection attacks or to automatically handle escaping string values.
XPath.each( node ) { |el| ... } XPath.each( node, '/*[@attr='v']' ) { |el| ... } XPath.each( node, 'ancestor::x' ) { |el| ... } XPath.each( node, '/book/publisher/text()=$publisher', {}, {"publisher"=>"O'Reilly"}) \ {|el| ... }
Returns an array of nodes matching a given XPath
.
Fetches item k
from the tuple.
Iterate through the tuple, yielding the index or key, and the value, thus ensuring arrays are iterated similarly to hashes.
Matches this template against tuple
. The tuple
must be the same size as the template. An element with a nil
value in a template acts as a wildcard, matching any value in the corresponding position in the tuple. Elements of the template match the tuple
if the are ==
or ===
.
Template.new([:foo, 5]).match Tuple.new([:foo, 5]) # => true Template.new([:foo, nil]).match Tuple.new([:foo, 5]) # => true Template.new([String]).match Tuple.new(['hello']) # => true Template.new([:foo]).match Tuple.new([:foo, 5]) # => false Template.new([:foo, 6]).match Tuple.new([:foo, 5]) # => false Template.new([:foo, nil]).match Tuple.new([:foo]) # => false Template.new([:foo, 6]).match Tuple.new([:foo]) # => false
Iterates over all discovered TupleSpaces starting with the primary.
Fetches key
from the tuple.
Matches this TemplateEntry
against tuple
. See Template#match
for details on how a Template
matches a Tuple
.
Yields event/tuple pairs until this NotifyTemplateEntry
expires.
Yields each Tuple
in this AvailableSet
Delegates to @hash