README.md in mpatch-2.6.0 vs README.md in mpatch-2.7.0
- old
+ new
@@ -16,11 +16,10 @@
```ruby
# load and patch all
require 'mpatch'
```
-
### example with Class methods
```ruby
require 'mpatch'
@@ -119,9 +118,54 @@
end
MPatch.patch!
# done, you all set
# if you want to contribute with use cases, please do so! :)
+```
+
+### Fun with access rights
+
+you can make an object / class / module instance or self methods private even from an instance
+
+```ruby
+
+ # this is used for make private methods in an object
+ # you can also use this to convert already defined methods in an object or class
+ # use:
+ #
+ # privatize in: 'hello_world' #> make hello world method private in the self obj
+ #
+ # privatize target: 'instance' #> you can use this in a class to make instance methods private
+ # privatize target: 'singleton' #> you can use this in a class to make self methods private
+ #
+ # privatize ex: Symbol/String/Array #> you can use this for make exceptions what should be not touched in the prcs
+ # privatize in: Symbol/String/Array #> you can use this for make targeted collection of methods for privatize
+ #
+
+ class Test
+
+ def say
+ "hello world"
+ end
+
+ def sup
+ "fine thx"
+ end
+
+ privatize t: :instance, ex: 'sup'
+
+ end
+
+ test1= Test.new
+
+ puts test1.sup #> fine thx
+
+ puts try{ test1.say } #> will fail and say error instead "hello world"
+ puts test1.__send__ :say #> hello world
+
+ test1.privatize only: 'sup'
+ puts try{ test1.sup } #> fail again because it's private
+
```
But there is a lot of method, for example for modules modules / subbmodules call that retunr modules under that namespace.
Lot of metaprogrammer stuff there too :)