Skip to content

Instantly share code, notes, and snippets.

@rf-
Created December 22, 2011 07:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rf-/1509388 to your computer and use it in GitHub Desktop.
Save rf-/1509388 to your computer and use it in GitHub Desktop.
[1] pry(main)> def x
[1] pry(main)* puts 'called x'
[1] pry(main)* callcc { |cc| return cc }
[1] pry(main)* end
=> nil
[2] pry(main)> def y
[2] pry(main)* puts 'called y'
[2] pry(main)* x.call
[2] pry(main)* ensure
[2] pry(main)* puts 'ensure block'
[2] pry(main)* end
=> nil
[3] pry(main)> y
called y
called x
ensure block
NoMethodError: undefined method `call' for nil:NilClass
from (pry):7:in `y'
[4] pry(main)> def x
[4] pry(main)* puts 'called x'
[4] pry(main)* callcc { |cc| return cc }
[4] pry(main)* ensure
[4] pry(main)* puts 'ensure in x'
[4] pry(main)* end
=> nil
[5] pry(main)> y
called y
called x
ensure in x
ensure in x
ensure block
NoMethodError: undefined method `call' for nil:NilClass
from (pry):7:in `y'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment