lib/sqlite_ext.rb in sqlite_ext-1.0.0 vs lib/sqlite_ext.rb in sqlite_ext-1.1.0

- old
+ new

@@ -67,13 +67,14 @@ prok.call(*args) end end end - # Registers most of the public module methods of Ruby's `Math` - # module to be used as a functions in SQL code executed - # through subsequent new instances of `SQLite3::Database`. + # Registers most of the public module methods of Ruby's + # `Math` module as well as `ceil` and `floor` to be used as + # functions in SQL code executed # through subsequent new + # instances of `SQLite3::Database`. # # The `Math.frexp` method is omitted becuse it returns an # array, and there is no way to return an array from a SQL # function in SQLite. # @@ -81,9 +82,12 @@ # for `register_function`. def register_ruby_math fn_methods = Math.public_methods - (Module.instance_methods << :frexp) fn_methods.each do |m| register_function m, Math.method(m) + end + [:floor, :ceil].each do |m| + register_function m, m.to_proc end end # Registers a #create_function call to be invoked on every # new instance of `SQLite3::Database` immidately after it is