I'm trying to prepend a binding.remote_pry
to all methods from all classes of my application for a test environment.
I try this:
classes = []
ObjectSpace.each_object { |o| classes << o if o.class == Class }
classes.each do |classe|
classe.methods.each do |method_name|
classe.class_eval do
define_method(method_name.to_sym) do
@@bindings ||= []
@@bindings << Thread.new {binding.remote_pry}
super
end
end
end
end
But I don't know how to call the super
of each method inside define_method
Am I trying to do something too much crazy here?
There is another way? Thanks in advance