README.md in method_watcher-0.0.1 vs README.md in method_watcher-0.0.2
- old
+ new
@@ -1,7 +1,10 @@
# MethodWatcher
+[![Gem Version](https://badge.fury.io/rb/method_watcher.png)](http://badge.fury.io/rb/method_watcher)
+[![Build Status](https://travis-ci.org/jjyr/method_watcher.png?branch=master)](https://travis-ci.org/jjyr/method_watcher)
+
Provide method\_overriding callback.
## Installation
Add this line to your application's Gemfile:
@@ -28,23 +31,48 @@
def bar
end
watch_methods :foo, :bar
+ unwatch_methods :bar
end
class B < A
def foo
end
end
#you will get a warning:
-#method A#foo is overridden
+# => method A#foo is overridden
#you can define you own behavior when method overriding.
#in class A:
def self.method_overriding method
- puts "OMG, method #{method} is overridden!!"
+ raise "OMG, method #{method} is overridden!!"
+end
+
+#you can also use it like ruby core methods private, protect and public
+require 'method_watcher'
+
+class A
+ include MethodWatcher
+
+ # if you pass no arguments, all methods below it will be watched
+ watch_methods
+
+ def foo
+ end
+
+ def foo2
+ end
+
+ # if you pass no arguments, it will disable watching, methods below it will not be watched
+ unwatch_methods
+
+ def bar
+ end
+
+ #in this example, methods foo, foo2 should be watched
end
```
## Contributing