XPath compiler now actually returns a Proc
This commit is contained in:
parent
d11a754946
commit
6d01adafc7
|
@ -30,11 +30,16 @@ module Oga
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
literal('lambda').add_block(document) do
|
proc_ast = literal('lambda').add_block(document) do
|
||||||
matched.assign(literal(XML::NodeSet).new)
|
matched.assign(literal(XML::NodeSet).new)
|
||||||
.followed_by(ruby_ast)
|
.followed_by(ruby_ast)
|
||||||
.followed_by(matched)
|
.followed_by(matched)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
generator = Ruby::Generator.new
|
||||||
|
source = generator.process(proc_ast)
|
||||||
|
|
||||||
|
eval(source)
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
|
@ -31,7 +31,7 @@ describe Oga::XPath::Compiler do
|
||||||
ast = parse_xpath('foo')
|
ast = parse_xpath('foo')
|
||||||
block = @compiler.compile(ast)
|
block = @compiler.compile(ast)
|
||||||
|
|
||||||
block.call(doc).should be_an_instance_of(NodeSet)
|
block.call(doc).should be_an_instance_of(Oga::XML::NodeSet)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue