Tidied up YARD documentation of the XPath compiler
This commit is contained in:
parent
54473d9865
commit
eb6cf68140
|
@ -106,13 +106,9 @@ module Oga
|
||||||
send("on_#{ast.type}", ast, input, &block)
|
send("on_#{ast.type}", ast, input, &block)
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
|
||||||
# Processes a relative path.
|
|
||||||
#
|
|
||||||
# @param [AST::Node] ast
|
# @param [AST::Node] ast
|
||||||
# @param [Oga::Ruby::Node] input
|
# @param [Oga::Ruby::Node] input
|
||||||
# @return [Oga::Ruby::Node]
|
# @return [Oga::Ruby::Node]
|
||||||
#
|
|
||||||
def on_path(ast, input, &block)
|
def on_path(ast, input, &block)
|
||||||
ruby_ast = nil
|
ruby_ast = nil
|
||||||
var_name = node_literal
|
var_name = node_literal
|
||||||
|
@ -464,22 +460,7 @@ module Oga
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# Processes a predicate using an expression.
|
# Processes a predicate using an expression (e.g. a path).
|
||||||
#
|
|
||||||
# This method generates Ruby code that roughly looks like the following:
|
|
||||||
#
|
|
||||||
# if catch :predicate_matched do
|
|
||||||
# node.children.each do |node|
|
|
||||||
#
|
|
||||||
# if some_condition_that_matches_a_predicate
|
|
||||||
# throw :predicate_matched, true
|
|
||||||
# end
|
|
||||||
#
|
|
||||||
# nil
|
|
||||||
# end
|
|
||||||
#
|
|
||||||
# matched.push(node)
|
|
||||||
# end
|
|
||||||
#
|
#
|
||||||
# @param [AST::Node] test
|
# @param [AST::Node] test
|
||||||
# @param [AST::Node] predicate
|
# @param [AST::Node] predicate
|
||||||
|
@ -829,42 +810,26 @@ module Oga
|
||||||
send(:"on_type_test_#{handler}", input, &block)
|
send(:"on_type_test_#{handler}", input, &block)
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
|
||||||
# Processes the `comment()` type test.
|
|
||||||
#
|
|
||||||
# @param [Oga::Ruby::Node] input
|
# @param [Oga::Ruby::Node] input
|
||||||
# @return [Oga::Ruby::Node]
|
# @return [Oga::Ruby::Node]
|
||||||
#
|
|
||||||
def on_type_test_comment(input)
|
def on_type_test_comment(input)
|
||||||
input.is_a?(XML::Comment)
|
input.is_a?(XML::Comment)
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
|
||||||
# Processes the `text()` type test.
|
|
||||||
#
|
|
||||||
# @param [Oga::Ruby::Node] input
|
# @param [Oga::Ruby::Node] input
|
||||||
# @return [Oga::Ruby::Node]
|
# @return [Oga::Ruby::Node]
|
||||||
#
|
|
||||||
def on_type_test_text(input)
|
def on_type_test_text(input)
|
||||||
input.is_a?(XML::Text)
|
input.is_a?(XML::Text)
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
|
||||||
# Processes the `processing-instruction()` type test.
|
|
||||||
#
|
|
||||||
# @param [Oga::Ruby::Node] input
|
# @param [Oga::Ruby::Node] input
|
||||||
# @return [Oga::Ruby::Node]
|
# @return [Oga::Ruby::Node]
|
||||||
#
|
|
||||||
def on_type_test_processing_instruction(input)
|
def on_type_test_processing_instruction(input)
|
||||||
input.is_a?(XML::ProcessingInstruction)
|
input.is_a?(XML::ProcessingInstruction)
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
|
||||||
# Processes the `node()` type test.
|
|
||||||
#
|
|
||||||
# @param [Oga::Ruby::Node] input
|
# @param [Oga::Ruby::Node] input
|
||||||
# @return [Oga::Ruby::Node]
|
# @return [Oga::Ruby::Node]
|
||||||
#
|
|
||||||
def on_type_test_node(input)
|
def on_type_test_node(input)
|
||||||
input.is_a?(XML::Node).or(input.is_a?(XML::Document))
|
input.is_a?(XML::Node).or(input.is_a?(XML::Document))
|
||||||
end
|
end
|
||||||
|
@ -1096,11 +1061,9 @@ module Oga
|
||||||
literal(ast.children[0].to_i.to_s)
|
literal(ast.children[0].to_i.to_s)
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
|
||||||
# @param [Array] vars The variables to assign.
|
# @param [Array] vars The variables to assign.
|
||||||
# @param [Oga::Ruby::Node] value
|
# @param [Oga::Ruby::Node] value
|
||||||
# @return [Oga::Ruby::Node]
|
# @return [Oga::Ruby::Node]
|
||||||
#
|
|
||||||
def mass_assign(vars, value)
|
def mass_assign(vars, value)
|
||||||
Ruby::Node.new(:massign, [vars, value])
|
Ruby::Node.new(:massign, [vars, value])
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue