Skip to content

Instantly share code, notes, and snippets.

@vadviktor
Created March 12, 2015 17:39
Show Gist options
  • Select an option

  • Save vadviktor/5cf83b3ba5447e2fc58a to your computer and use it in GitHub Desktop.

Select an option

Save vadviktor/5cf83b3ba5447e2fc58a to your computer and use it in GitHub Desktop.
Plain example using Ruby Kernel::catch http://ruby-doc.org/core-2.2.1/Kernel.html#method-i-catch
s = nil
f = nil
s = catch :skipped do
f = catch :failed do
throw :skipped, 'i skipped'
# throw :failed, 'i failed'
end
'deal with failed code' unless f.nil?
end
'deal with skipped code' unless s.nil?
puts s.inspect
puts f.inspect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment