sinatra-websocketio 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ === 0.2.2 2013-03-26
2
+
3
+ * bugfix WebSocketIO::push
4
+
1
5
  === 0.2.1 2013-03-26
2
6
 
3
7
  * fix WebSocketIO::push
@@ -1,5 +1,5 @@
1
1
  module Sinatra
2
2
  module WebSocketIO
3
- VERSION = "0.2.1"
3
+ VERSION = "0.2.2"
4
4
  end
5
5
  end
@@ -47,17 +47,18 @@ module Sinatra
47
47
 
48
48
  def self.push(type, data, opt={})
49
49
  session_ids = opt[:to].to_s.empty? ? self.sessions.keys : [opt[:to]]
50
- if opt.include? :to and self.sessions.include? opt[:to]
50
+ if opt.include? :to
51
+ return unless self.sessions.include? opt[:to]
51
52
  s = self.sessions[opt[:to]]
52
53
  begin
53
54
  s.send({:type => type, :data => data}.to_json)
54
55
  rescue => e
55
56
  emit :error, "websocketio push error (session:#{opt[:to]})"
56
57
  end
57
- else
58
- self.sessions.keys.each do |id|
59
- push type, data, :to => id
60
- end
58
+ return
59
+ end
60
+ self.sessions.keys.each do |id|
61
+ push type, data, :to => id
61
62
  end
62
63
  end
63
64
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra-websocketio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-25 00:00:00.000000000 Z
12
+ date: 2013-03-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: minitest