Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/proxy_block.rb
Instance Method Summary collapse
Instance Method Details
#proxy_block(method) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/proxy_block.rb', line 2 def proxy_block(method) unless self.class.method_defined?("orig_#{method}") alias_method "orig_#{method}", method class_eval %{ def #{method}(*args, &block) if block_given? orig_#{method}(*args, &block) else BlockProxy.new(self, :orig_#{method}, *args) end end } end end |