Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/mighty_tap.rb
Instance Method Summary collapse
- #mighty_tap(*args, &block) ⇒ Object (also: #mtap)
Instance Method Details
#mighty_tap(*args, &block) ⇒ Object Also known as: mtap
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/mighty_tap.rb', line 4 def mighty_tap(*args, &block) if args.length > 1 && args.last.is_a?(Proc) method_block_proc = args.pop end if args[0].is_a?(String) || args[0].is_a?(Symbol) self.send(args[0], *args[1..-1], &method_block_proc) elsif args[0].respond_to?(:call) args[0].call(self, *args[1..-1], &method_block_proc) end if block_given? yield self end self end |