nobrainer_streams 0.1.0 → 0.2.0
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 +4 -4
- data/README.md +5 -6
- data/lib/nobrainer_streams.rb +10 -1
- data/lib/nobrainer_streams/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa1243a0b6bdfb393669a67617f5abe03e3a9cbd
|
4
|
+
data.tar.gz: d8387bbed7738e94bdef3734fb59188a84370ec3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 140072064c717081f350b094a1c4cf38e8a89ca9d3c43bf432002894ffacd5151d90db1c9180459f66902ad33afbc7419f0513bf367dfd6f525fa6a6983d56f6
|
7
|
+
data.tar.gz: a662bca7550f11f813b4934a5b58889930fb2dfc6ff832c96c9ab44647eb8d2af526ac769e1a301c407ee07abccf8f3f1133064e477d4bf535179cb3fe43c0a2
|
data/README.md
CHANGED
@@ -1,8 +1,11 @@
|
|
1
1
|
# NobrainerStreams
|
2
2
|
|
3
|
-
|
3
|
+
This gem (hopefully) is temporary, pending these two pull requests:
|
4
4
|
|
5
|
-
|
5
|
+
[rethinkdb#5973](https://github.com/rethinkdb/rethinkdb/pull/5973)
|
6
|
+
[nobrainer#192](https://github.com/nviennot/nobrainer/pull/192)
|
7
|
+
|
8
|
+
If they are merged I will disable this gem.
|
6
9
|
|
7
10
|
## Installation
|
8
11
|
|
@@ -20,10 +23,6 @@ Or install it yourself as:
|
|
20
23
|
|
21
24
|
$ gem install nobrainer_streams
|
22
25
|
|
23
|
-
## Usage
|
24
|
-
|
25
|
-
TODO: Write usage instructions here
|
26
|
-
|
27
26
|
## Development
|
28
27
|
|
29
28
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/lib/nobrainer_streams.rb
CHANGED
@@ -28,9 +28,18 @@ module NoBrainer::Streams
|
|
28
28
|
transmit changes, via: "streamed from #{query.inspect}"
|
29
29
|
end
|
30
30
|
|
31
|
+
deserialize = -> (changes) do
|
32
|
+
klass = query.model
|
33
|
+
old_val = changes['old_val']
|
34
|
+
new_val = changes['new_val']
|
35
|
+
changes['old_val'] = klass.new(old_val) if old_val
|
36
|
+
changes['new_val'] = klass.new(new_val) if new_val
|
37
|
+
callback.call(changes)
|
38
|
+
end
|
39
|
+
|
31
40
|
# defer_subscription_confirmation!
|
32
41
|
connection = NoBrainer::Streams::streams_connection
|
33
|
-
cursor = query.to_rql.changes(options).async_run(connection, ConcurrentAsyncHandler, &
|
42
|
+
cursor = query.to_rql.changes(options).async_run(connection, ConcurrentAsyncHandler, &deserialize)
|
34
43
|
nobrainer_cursors << cursor
|
35
44
|
end
|
36
45
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nobrainer_streams
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tinco Andringa
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|