Skip to content

Instantly share code, notes, and snippets.

@leehambley
Created February 23, 2012 15:05
Show Gist options
  • Save leehambley/295a284c0e0d345d105d to your computer and use it in GitHub Desktop.
Save leehambley/295a284c0e0d345d105d to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'ruby-debug'
def example
debugger
puts "Hello, I'm example"
end
def add_listener(&block)
$listeners ||= Array.new
$listeners.push(&block)
end
def ping_listeners
$listeners.map(&:call)
end
# Drops into the debugger as expected
example
# Erm... WAT!?
add_listener(&method(:example))
ping_listeners
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment