Module: YoureDoingItWrong

Defined in:
lib/youre_doing_it_wrong.rb

Class Method Summary collapse

Class Method Details

.do_it_right!Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/youre_doing_it_wrong.rb', line 4

def do_it_right!
  warn "[YDIW] The noise starts here, if you hear a peep from me, you're evil"
  [Object, Kernel, Class, Module].each do |c|
    c.class_eval do
      def method_added *a
        warn "[YDIW] You did it wrong @ #{caller[1]} (method_added)"
        super if defined? super
      end

      alias singleton_method_added method_added

      def extended(base)
        warn "[YDIW] You did it wrong @ #{caller[1]} (extend)"
        super if defined? super
      end
    end
  end
end