def remove_function( name, callable_or_arity = nil )
arity = nil
if callable_or_arity.respond_to?( :to_proc ) then
arity = callable_or_arity.to_proc.arity
elsif callable_or_arity.respond_to?( :to_int ) then
arity = callable_or_arity.to_int
end
to_remove = []
if arity then
signature = ::Amalgalite::SQLite3::Database::Function.signature( name, arity )
db_function = @functions[ signature ]
raise FunctionError, "db function '#{name}' with arity #{arity} does not appear to be defined" unless db_function
to_remove << db_function
else
possibles = @functions.values.select { |f| f.name == name }
raise FunctionError, "no db function '#{name}' appears to be defined" if possibles.empty?
to_remove = possibles
end
to_remove.each do |db_function|
@api.remove_function( db_function.name, db_function)
@functions.delete( db_function.signature )
end
end