Class: Proc
- Inherits:
-
Object
- Object
- Proc
- Defined in:
- lib/on/proc.rb
Overview
Syntatic sugar for creating an on
callback from Proc.
Example
require 'on/proc'
def tweet(, &block)
callback = block.on(:success, :failure)
callback.call :success
rescue => e
callback.call :failure, e.
end
tweet "hello world" do |callback|
callback.on :success do
# handle success
end
callback.on :failure do ||
# handle error message
end
end