-
-
Save leehambley/295a284c0e0d345d105d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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