Skip to content

Instantly share code, notes, and snippets.

@cyx
Created April 6, 2010 13:24
Show Gist options
  • Save cyx/357585 to your computer and use it in GitHub Desktop.
Save cyx/357585 to your computer and use it in GitHub Desktop.
def on(error, message = (block_given? ? yield : raise(ArgumentError)))
handle(error) do
@output << message
end
end
protected
def handle(error)
if (errors = @errors.select {|e| error === e }).any?
@unhandled -= errors
yield(errors) if block_given?
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment