Support for the XPath floor() function.

This commit is contained in:
Yorick Peterse committed 2014-08-27 23:52:23 +02:00
1 parent 27d2b6c2c3
commit c8fb1ad202
2 files changed
+45

No files matched your search

+15
View File
@@ -1185,6 +1185,21 @@ module Oga
return sum
end
##
# Processes the `floor()` function call.
#
# This function floors a numeric value and returns the result as a float.
#
# @param [Oga::XML::NodeSet] context
# @param [Oga::XPath::Node] expression
# @return [Float]
#
def on_call_floor(context, expression)
number = on_call_number(context, expression)
return number.nan? ? number : number.floor.to_f
end
##
# Processes an `(int)` node.
#