Skip to content

Commit

Permalink
Ability to call wait_for_callback as a class method.
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Pearce committed Feb 16, 2014
1 parent a014605 commit 9cf7641
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/coinmux/threading.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module Coinmux::Threading
def wait_for_callback(*args, &callback)
def self.wait_for_callback(object, method, *args, &callback)
done = false
results = nil
send(*args) do |*callback_results|
object.send(method, *args) do |*callback_results|
done = true
results = callback_results
end
Expand All @@ -11,4 +11,8 @@ def wait_for_callback(*args, &callback)

results
end

def wait_for_callback(method, *args, &callback)
Coinmux::Threading.wait_for_callback(self, method, *args, &callback)
end
end

0 comments on commit 9cf7641

Please sign in to comment.