Module: Kernel

Defined in:
lib/cb.rb

Overview

Utility method for coercing arguments to an object that responds to #call Accepts an object and a method name to send to, or a block, or an object that responds to call.

cb = Callback{ |msg| puts(msg) }
cb.call('hello world')

cb = Callback(Object, :puts)
cb.call('hello world')

cb = Callback(proc{ |msg| puts(msg) })
cb.call('hello world')