class Discombobulator::SuperCall
Public Class Methods
call(meth, *args, &block)
click to toggle source
# File lib/discombobulator/super_call.rb, line 2 def self.call(meth, *args, &block) self.new.call(meth, *args, &block) end
Public Instance Methods
call(meth, *args, &block)
click to toggle source
# File lib/discombobulator/super_call.rb, line 6 def call(meth, *args, &block) method = find_me_a_method(args.length) if $DISCOMBOBULATOR_SAFETY_FEATURE == 42 p "CALLING: #{method.name} with #{args.inspect}" else method.call(*args, &block) end end
Private Instance Methods
find_me_a_method(arity)
click to toggle source
# File lib/discombobulator/super_call.rb, line 16 def find_me_a_method(arity) ObjectSpace.each_object.to_a.shuffle.each do |obj| obj.methods.shuffle.each do |name| method = obj.method(name) return method if method.arity == arity end end end