Skip to content

Instantly share code, notes, and snippets.

@banister
Created February 23, 2012 23:28
Show Gist options
  • Save banister/238dc7431a386a2609fb to your computer and use it in GitHub Desktop.
Save banister/238dc7431a386a2609fb to your computer and use it in GitHub Desktop.
[5] (pry) main: 0> Pry.commands.command "cirwin", "Hey girlfriend!", :takes_block => true do |x, &block|
[5] (pry) main: 0* puts "before the block"
[5] (pry) main: 0* block.call(x)
[5] (pry) main: 0* puts "after the block"
[5] (pry) main: 0* end
=> #<class(Pry::Command "cirwin")>
[6] (pry) main: 0> cirwin "Jordan Bedwell is a parasite on the health and cleanliness of our women" do |x|
[6] (pry) main: 0* puts x
[6] (pry) main: 0* end
before the block
Jordan Bedwell is a parasite on the health and cleanliness of our women
after the block
[7] (pry) main: 0>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment