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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 125a83bd937986bdaa5a9c293e5117058f2a0a10
4
- data.tar.gz: a2b4a215c810d771e40a17812ec15a956d17d43d
3
+ metadata.gz: fa1243a0b6bdfb393669a67617f5abe03e3a9cbd
4
+ data.tar.gz: d8387bbed7738e94bdef3734fb59188a84370ec3
5
5
  SHA512:
6
- metadata.gz: c5fe359a10db56bf735f70f8ad1fe7bab419636c7f7c4cc5d16d89911ad471ba2efc9f8b1ffdff8c4dd414b8f1664b9d653d43a0547a14b9c85a3566ea44c258
7
- data.tar.gz: 6d946363a70775ee105a647089a126b844ff0528e28ce9b6ee99642f9192304ae8f2825f1a239f00dd3fb33e8f6ce4b23c753641027e932d32639bf23acedfc6
6
+ metadata.gz: 140072064c717081f350b094a1c4cf38e8a89ca9d3c43bf432002894ffacd5151d90db1c9180459f66902ad33afbc7419f0513bf367dfd6f525fa6a6983d56f6
7
+ data.tar.gz: a662bca7550f11f813b4934a5b58889930fb2dfc6ff832c96c9ab44647eb8d2af526ac769e1a301c407ee07abccf8f3f1133064e477d4bf535179cb3fe43c0a2
data/README.md CHANGED
@@ -1,8 +1,11 @@
1
1
  # NobrainerStreams
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/nobrainer_streams`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ This gem (hopefully) is temporary, pending these two pull requests:
4
4
 
5
- TODO: Delete this and the text above, and describe your gem
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.
@@ -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, &callback)
42
+ cursor = query.to_rql.changes(options).async_run(connection, ConcurrentAsyncHandler, &deserialize)
34
43
  nobrainer_cursors << cursor
35
44
  end
36
45
 
@@ -1,3 +1,3 @@
1
1
  module NobrainerStreams
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
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.1.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-07-27 00:00:00.000000000 Z
11
+ date: 2016-08-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler