Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/exec_if.rb
Instance Method Summary collapse
Instance Method Details
#exec_if(obj, &blk) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/exec_if.rb', line 4 def exec_if(obj, &blk) case obj when Proc obj.call(self) ? blk.call(self, obj) : self when Symbol public_send(obj) ? blk.call(self, obj) : self when String eval(obj) ? blk.call(self, obj) : self when Object obj ? blk.call(self, obj) : self when nil, false self end end |