lib/night_vision.rb in night_vision-0.0.1 vs lib/night_vision.rb in night_vision-0.1.0

- old
+ new

@@ -1,5 +1,24 @@ require "night_vision/version" module NightVision - # Your code goes here... -end + DIVIDER = "------------------------------------------------" + def self.goggles(*classes) + classes.each do |klass| + klass.instance_methods.each do |method| + m = klass.instance_method(method) + klass.send(:define_method, method) do |*args, &block| + puts DIVIDER + puts "Invoking #{m.owner}##{method}" + puts "Actual arguments are: #{args}" + puts DIVIDER + val = m.bind(self).(*args, &block) + puts DIVIDER + puts "Returning from #{m.owner}##{method}" + puts "Return value is: #{val}" + puts DIVIDER + val + end + end + end + end +end \ No newline at end of file