sinatra-rocketio-linda 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3edaf3542a808465b17d39e554bdf5321737dcd5
4
- data.tar.gz: 8eaad6421592d499c941f4fce900aac50172c617
3
+ metadata.gz: 078d94db2541cb4f0725832183ea614aaedd0b04
4
+ data.tar.gz: 818d263f79220681155b57bb1406f94165b1c9bd
5
5
  SHA512:
6
- metadata.gz: cd936f5a91b10b98ddb2f753c2a40a61a50ca1b816ab44c9ae81790185d344a50f64177eaf20e357c19f5b6651b039dd53bda4d09f170aeed6abd3f0b3ed4982
7
- data.tar.gz: cbcf2094ea503574097b95c13adaf8c909ebac2d3e61d5eb580c5cbbd9b7fac698eb360980b17ddcf4dae2aa08c8d2ec5344e0aa0cf3b47723daf9e74ee23311
6
+ metadata.gz: 42405ce2bd52ebd099b8c3282a9e63263a758275d99aea15b45188e2f9087f3da3955d4526c230626b16edf80dd882982c587bb372702340bafe0034f865b983
7
+ data.tar.gz: e6e7c83e110f747536ae8687961bc5d890f18b5c79405b2b070a864d90492e7aebfa6295293ecaee487b38fb123ca09d07e2e19755cc9c8de82fe25792892280
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ === 0.0.7 2013-05-24
2
+
3
+ * add function Sinatra::RocketIO::Linda::Client#wait
4
+
1
5
  === 0.0.6 2013-05-22
2
6
 
3
7
  * emit tuple operation events
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  sinatra-rocketio-linda
2
2
  ======================
3
3
 
4
- * Linda implementation on Sinatra::RocketIO
4
+ * [Linda](https://github.com/shokai/linda-ruby) implementation on [Sinatra::RocketIO](https://github.com/shokai/sinatra-rocketio)
5
5
  * https://github.com/shokai/sinatra-rocketio-linda
6
6
 
7
7
 
@@ -143,8 +143,7 @@ linda.io.on :connect do ## RocketIO's "connect" event
143
143
  calc.call
144
144
  end
145
145
 
146
- loop do
147
- end
146
+ linda.wait
148
147
  ```
149
148
 
150
149
 
@@ -7,17 +7,24 @@ module Sinatra
7
7
 
8
8
  class Client
9
9
  attr_reader :io, :tuplespace
10
- def initialize(io)
11
- if io.kind_of? String and io =~ /^https?:\/\/.+$/
12
- @io = Sinatra::RocketIO::Client.new(io).connect
13
- elsif io.kind_of? Sinatra::RocketIO::Client
14
- @io = io
10
+ def initialize(io_or_url)
11
+ if io_or_url.kind_of? String and io_or_url =~ /^https?:\/\/.+$/
12
+ @io = Sinatra::RocketIO::Client.new(io_or_url).connect
13
+ elsif io_or_url.kind_of? ::Sinatra::RocketIO::Client
14
+ @io = io_or_url
15
15
  else
16
16
  raise ArgumentError, "argument must be URL or RocketIO::Client"
17
17
  end
18
18
  @tuplespace = Hash.new{|h,k|
19
19
  h[k] = Sinatra::RocketIO::Linda::Client::TupleSpace.new(k, self)
20
20
  }
21
+ end
22
+
23
+ def wait(&block)
24
+ loop do
25
+ sleep 1
26
+ yield if block_given?
27
+ end
21
28
  end
22
29
 
23
30
  class TupleSpace
@@ -1,7 +1,7 @@
1
1
  module Sinatra
2
2
  module RocketIO
3
3
  module Linda
4
- VERSION = "0.0.6"
4
+ VERSION = "0.0.7"
5
5
  end
6
6
  end
7
7
  end
@@ -17,5 +17,4 @@ linda.io.on :disconnect do
17
17
  puts "disconnect #{io.session}"
18
18
  end
19
19
 
20
- loop do
21
- end
20
+ linda.wait
@@ -25,5 +25,8 @@ linda.io.on :disconnect do
25
25
  puts "disconnect #{io.session}"
26
26
  end
27
27
 
28
- loop do
28
+ linda.io.on :error do |err|
29
+ STDERR.puts err
29
30
  end
31
+
32
+ linda.wait
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra-rocketio-linda
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sho Hashimoto
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-21 00:00:00.000000000 Z
11
+ date: 2013-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler