Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Anise 0.5

  • Loading branch information...
commit c4ed5a35772e18b2d9a9ec6cfcbdd1a6a33ae8cf 1 parent 725f4fb
@RISCfuture authored
Showing with 14 additions and 7 deletions.
  1. +1 −2  Gemfile.lock
  2. +1 −1  libs/leaf.rb
  3. +12 −4 libs/stem.rb
View
3  Gemfile.lock
@@ -3,8 +3,7 @@ GEM
specs:
activesupport (3.0.7)
addressable (2.2.5)
- anise (0.4.0)
- facets (> 2.4.0)
+ anise (0.5.0)
chronic (0.3.0)
daemons (1.1.3)
data_objects (0.10.5)
View
2  libs/leaf.rb
@@ -143,7 +143,7 @@ module Autumn
# initialization options; see initialize.
class Leaf
- include Anise::Annotation
+ include Anise
# Default for the +command_prefix+ init option.
DEFAULT_COMMAND_PREFIX = '!'
View
16 libs/stem.rb
@@ -150,7 +150,7 @@ module Autumn
class Stem
include StemFacade
- include Anise::Annotation
+ include Anise
# Describes all possible channel names. Omits the channel prefix, as that
# can vary from server to server. (See channel?)
@@ -462,7 +462,7 @@ def initialize(server, newnick, opts)
def add_listener(obj)
@listeners << obj
- obj.class.extend Anise::Annotation # give it the ability to sync
+ obj.class.send :include, Anise # give it the ability to sync
obj.respond :added, self
end
@@ -484,7 +484,7 @@ def add_listener(obj)
# "Synchronous Methods" in the class docs.)
def broadcast(meth, *args)
- @listeners.select { |listener| not listener.class.ann(meth, :stem_sync) }.each do |listener|
+ asynchronous_listeners_for_method(meth).each do |listener|
Thread.new do
begin
listener.respond meth, *args
@@ -506,7 +506,7 @@ def broadcast(meth, *args)
# _have_ been marked as synchronized.
def broadcast_sync(meth, *args)
- @listeners.select { |listener| listener.class.ann(meth, :stem_sync) }.each { |listener| listener.respond meth, *args }
+ synchronous_listeners_for_method(meth).each { |listener| listener.respond meth, *args }
end
# Opens a connection to the IRC server and begins listening on it. This
@@ -1008,5 +1008,13 @@ def drop_channel(channel)
def privmsgt(*args) # a throttled privmsg
@messages_queue << args
end
+
+ def asynchronous_listeners_for_method(meth)
+ @listeners.select { |listener| not listener.class.ann(meth, :stem_sync) }
+ end
+
+ def synchronous_listeners_for_method(meth)
+ @listeners.select { |listener| listener.class.ann(meth, :stem_sync) }
+ end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.