lib/faye-rails/controller/channel.rb in faye-rails-1.0.3 vs lib/faye-rails/controller/channel.rb in faye-rails-1.0.4
- old
+ new
@@ -23,11 +23,11 @@
FayeRails.server(endpoint).bind(event) do |*args|
Monitor.new.tap do |m|
m.client_id = args.shift
m.channel = args.shift
m.data = args.shift
- m.instance_eval(&block) if m.channel == channel
+ m.instance_eval(&block) if File.fnmatch(channel, m.channel)
end
end
end
def filter(direction=:any, &block)
@@ -37,10 +37,10 @@
filter.server = server
filter
end
def subscribe(&block)
- EM.schedule do
+ EM.schedule do
@subscription = FayeRails.client(endpoint).subscribe(channel) do |message|
Message.new.tap do |m|
m.message = message
m.channel = channel
m.instance_eval(&block)