Could it be that you pollute the global namespace ?
If you ask your users to ‘include’ your library this can happen easily!
Calculate footprint
initial = methods.count + Module.constants.count require 'my_library' include MyLibrary puts "Namespace-Footprint" puts methods.count + Module.constants.count - initial
How to clean up ?
A simple solution is adding a separate Inclusion module, that does not live in your main
namespace and redirect all methods you want to share with the user from your main namespace.
#my_library/inclusion.rb
module MyLibrary
module Inclusion
...
end
end
#my_library.rb
module MyLibrary
..
Inclusion.public_instance_methods.each do |method|
define_method method do |*args|
Inclusion.send(method,*args)
end
end
end