samples/with_module.rb in after_do-0.3.1 vs samples/with_module.rb in after_do-0.4.0
- old
+ new
@@ -15,20 +15,34 @@
class C
include M
def method
- puts 'Overwritten method'
+ puts 'Overridden method'
end
end
+class D
+ prepend M
+
+ def method
+ puts 'Wanna be Overriden method'
+ end
+end
+
M.extend AfterDo
M.after :method do puts 'method called' end
A.new.method
B.new.method
-C.new.method # won't call callback since the implementation was overriden
+# won't call callback since the implementation was overriden
+C.new.method
+
+# will call callback since the module extending AfterDo was prepended
+D.new.method
+
# Output is:
# method called
# method called
-# Overridden method
\ No newline at end of file
+# Overridden method
+# method called