linda-socket.io-client 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +0 -1
- data/Gemfile.lock +3 -1
- data/History.txt +4 -0
- data/README.md +2 -3
- data/lib/linda-socket.io-client/client.rb +12 -3
- data/lib/linda-socket.io-client/version.rb +1 -1
- data/lib/linda-socket.io-client.rb +5 -4
- data/linda-socket.io-client.gemspec +1 -0
- data/samples/sample.rb +2 -2
- data/test/test_linda.rb +8 -8
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d741bf7229adf24256bfe5324bc159c1d12952d4
|
4
|
+
data.tar.gz: 186ecdea6c5ba6f92383ddfc0f650cd70fb78561
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 039f123acc35ea769fbad3f0cfb7c5ea95f711f3c96a901bf9008496801e1bc16a3efe0fc2ed387ee81783d7e6824c71e36e25dfb125096dc03728dd3d04cddc
|
7
|
+
data.tar.gz: e08278e32f67cb982f755c53cdd96ece5ac1bda9d6d17eab536744a0c7d63a67f9ccd5445044a2d45ebb36085d4b0e876c943070f51ec50f0eaa35ed5b4261f2
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
linda-socket.io-client (0.0.
|
4
|
+
linda-socket.io-client (0.0.2)
|
5
5
|
event_emitter
|
6
|
+
hashie
|
6
7
|
json
|
7
8
|
socket.io-client-simple (>= 0.0.3)
|
8
9
|
|
@@ -10,6 +11,7 @@ GEM
|
|
10
11
|
remote: https://rubygems.org/
|
11
12
|
specs:
|
12
13
|
event_emitter (0.2.5)
|
14
|
+
hashie (2.0.5)
|
13
15
|
httparty (0.12.0)
|
14
16
|
json (~> 1.8)
|
15
17
|
multi_xml (>= 0.5.2)
|
data/History.txt
CHANGED
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
- Ruby client for [linda-socket.io](https://github.com/node-linda/linda-socket.io)
|
4
4
|
|
5
|
-
[![Travis-CI build status](https://travis-ci.org/node-linda/linda-socket.io-client-ruby.png)](https://travis-ci.org/node-linda/linda-socket.io-client-ruby)
|
5
|
+
[![Travis-CI build status](https://travis-ci.org/node-linda/linda-socket.io-client-ruby.png?branch=master)](https://travis-ci.org/node-linda/linda-socket.io-client-ruby)
|
6
6
|
|
7
7
|
|
8
8
|
## Installation
|
@@ -25,8 +25,7 @@ linda.io.on :connect do
|
|
25
25
|
|
26
26
|
ts.watch type: "chat" do |err, tuple|
|
27
27
|
next if err
|
28
|
-
|
29
|
-
puts "> #{msg}"
|
28
|
+
puts "> #{tuple.data.msg} (from:#{tuple.from})"
|
30
29
|
end
|
31
30
|
end
|
32
31
|
|
@@ -6,6 +6,9 @@ module Linda
|
|
6
6
|
::Linda::SocketIO::Client::Client.new(url_or_io)
|
7
7
|
end
|
8
8
|
|
9
|
+
class Tuple < ::Hashie::Mash
|
10
|
+
end
|
11
|
+
|
9
12
|
class Client
|
10
13
|
|
11
14
|
attr_reader :io
|
@@ -47,7 +50,9 @@ module Linda
|
|
47
50
|
return unless block_given?
|
48
51
|
id = create_callback_id
|
49
52
|
name = "__linda_take_#{id}"
|
50
|
-
io_cid = @linda.io.once name,
|
53
|
+
io_cid = @linda.io.once name do |err, tuple|
|
54
|
+
block.call err, Tuple.new(tuple)
|
55
|
+
end
|
51
56
|
@linda.io.emit '__linda_take', {:tuplespace => @name, :tuple => tuple, :id => id}
|
52
57
|
return id
|
53
58
|
end
|
@@ -56,7 +61,9 @@ module Linda
|
|
56
61
|
return unless block_given?
|
57
62
|
id = create_callback_id
|
58
63
|
name = "__linda_read_#{id}"
|
59
|
-
io_cid = @linda.io.once name,
|
64
|
+
io_cid = @linda.io.once name do |err, tuple|
|
65
|
+
block.call err, Tuple.new(tuple)
|
66
|
+
end
|
60
67
|
@linda.io.emit '__linda_read', {:tuplespace => @name, :tuple => tuple, :id => id}
|
61
68
|
return id
|
62
69
|
end
|
@@ -65,7 +72,9 @@ module Linda
|
|
65
72
|
return unless block_given?
|
66
73
|
id = create_watch_callback_id tuple
|
67
74
|
name = "__linda_watch_#{id}"
|
68
|
-
io_cid = @linda.io.on name,
|
75
|
+
io_cid = @linda.io.on name do |err, tuple|
|
76
|
+
block.call err, Tuple.new(tuple)
|
77
|
+
end
|
69
78
|
@linda.io.emit '__linda_watch', {:tuplespace => @name, :tuple => tuple, :id => id}
|
70
79
|
return id
|
71
80
|
end
|
@@ -1,11 +1,12 @@
|
|
1
|
-
require "linda-socket.io-client/version"
|
2
|
-
require "linda-socket.io-client/error"
|
3
|
-
require "linda-socket.io-client/client"
|
4
|
-
|
5
1
|
require 'json'
|
2
|
+
require 'hashie'
|
6
3
|
require 'event_emitter'
|
7
4
|
require 'socket.io-client-simple'
|
8
5
|
|
6
|
+
require "linda-socket.io-client/version"
|
7
|
+
require "linda-socket.io-client/error"
|
8
|
+
require "linda-socket.io-client/client"
|
9
|
+
|
9
10
|
module Linda
|
10
11
|
module SocketIO
|
11
12
|
module Client
|
data/samples/sample.rb
CHANGED
data/test/test_linda.rb
CHANGED
@@ -37,7 +37,7 @@ class TestLindaClient < MiniTest::Test
|
|
37
37
|
ts = client.tuplespace("test_write_watch")
|
38
38
|
ts.watch foo: "bar" do |err, tuple|
|
39
39
|
next if err
|
40
|
-
results.push tuple
|
40
|
+
results.push tuple.data
|
41
41
|
end
|
42
42
|
ts.write a: "b", name: "shokai"
|
43
43
|
ts.write write_data
|
@@ -56,11 +56,11 @@ class TestLindaClient < MiniTest::Test
|
|
56
56
|
ts = client.tuplespace("test_read")
|
57
57
|
ts.read foo: "bar" do |err, tuple|
|
58
58
|
next if err
|
59
|
-
results.push tuple
|
59
|
+
results.push tuple.data
|
60
60
|
end
|
61
61
|
ts.read foo: "bar" do |err, tuple|
|
62
62
|
next if err
|
63
|
-
results.push tuple
|
63
|
+
results.push tuple.data
|
64
64
|
end
|
65
65
|
ts.write a: "b", name: "shokai"
|
66
66
|
ts.write write_data
|
@@ -79,11 +79,11 @@ class TestLindaClient < MiniTest::Test
|
|
79
79
|
ts = client.tuplespace("test_take")
|
80
80
|
ts.take foo: "bar" do |err, tuple|
|
81
81
|
next if err
|
82
|
-
results.push tuple
|
82
|
+
results.push tuple.data
|
83
83
|
end
|
84
84
|
ts.take foo: "bar" do |err, tuple|
|
85
85
|
next if err
|
86
|
-
results.push tuple
|
86
|
+
results.push tuple.data
|
87
87
|
end
|
88
88
|
ts.write a: "b", name: "shokai"
|
89
89
|
ts.write write_data
|
@@ -102,7 +102,7 @@ class TestLindaClient < MiniTest::Test
|
|
102
102
|
ts = client.tuplespace("test_watch_cancel")
|
103
103
|
id = ts.watch foo: "bar" do |err, tuple|
|
104
104
|
next if err
|
105
|
-
results.push tuple
|
105
|
+
results.push tuple.data
|
106
106
|
end
|
107
107
|
ts.cancel id
|
108
108
|
ts.write write_data
|
@@ -120,7 +120,7 @@ class TestLindaClient < MiniTest::Test
|
|
120
120
|
ts = client.tuplespace("test_read_cancel")
|
121
121
|
cid = ts.read foo: "bar" do |err, tuple|
|
122
122
|
next if err
|
123
|
-
results.push tuple
|
123
|
+
results.push tuple.data
|
124
124
|
end
|
125
125
|
ts.cancel cid
|
126
126
|
ts.write write_data
|
@@ -139,7 +139,7 @@ class TestLindaClient < MiniTest::Test
|
|
139
139
|
ts = client.tuplespace("test_take_cancel")
|
140
140
|
cid = ts.take foo: "bar" do |err, tuple|
|
141
141
|
next if err
|
142
|
-
results.push tuple
|
142
|
+
results.push tuple.data
|
143
143
|
end
|
144
144
|
ts.cancel cid
|
145
145
|
ts.write write_data
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: linda-socket.io-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sho Hashimoto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-01-
|
11
|
+
date: 2014-01-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: hashie
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: event_emitter
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|