sereal 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/rsrl +18 -0
  3. data/ext/sereal/decode.c +6 -3
  4. metadata +5 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b17ebc8e9c34db04bd5e21e712925a91c6e03aa6
4
- data.tar.gz: f0984c679f1c7a7053f961d1d211ce5160c76375
3
+ metadata.gz: bac669b1c7ac841a45408831331a217d124f0214
4
+ data.tar.gz: 36d8e97569db8dd83488cdc6814509865d065767
5
5
  SHA512:
6
- metadata.gz: d7d044c11e0c06e24d3d5ab7fe131761bc8031a85030e23bd693e633d2e8ab842e52d4f76665314b1ae155eafa812e74abf26c13d91582ed24c939c476342fc9
7
- data.tar.gz: 71ab51d02f317100e0d9fe613227e4e1d26856d6b1c0374ff8af223867d8ceefae71712be8f4d04ce9dc7b3023e7809850511a85b26a61b802f1a13aa02a3996
6
+ metadata.gz: ec82fea24d7ea01a8499df9b479f9637a162d7d97f2fe523202ce2238fa9a0f474fff88c76475c6c2a28d7a44031fcc5a789c95dc8baa31741971b79c0987306
7
+ data.tar.gz: e6e8447c22300cee2d630fd0237c59f3145605cb47c8ca1cf4263c92a45249b28f5f51944f17dbc382724a2e378af3583575221218f11d369c5270a459c32fc1
@@ -0,0 +1,18 @@
1
+ #!/usr/bin/env ruby
2
+ require 'sereal'
3
+
4
+ content = ARGF.read
5
+ compress = Sereal::RAW
6
+
7
+ {'Sereal_LZ4' => Sereal::LZ4, 'Sereal_SNAPPY' => Sereal::SNAPPY,'Sereal_SNAPPY_INCR' => Sereal::SNAPPY_INCR,'Sereal_LZ4HC' => Sereal::LZ4HC }.each do |k,v|
8
+ if ENV[k]
9
+ compress = v
10
+ end
11
+ end
12
+ if content[0..3] == '=srl'
13
+ Sereal.decode(content) do |x|
14
+ STDOUT.write(x)
15
+ end
16
+ else
17
+ STDOUT.write(Sereal.encode(content, compress))
18
+ end
@@ -195,7 +195,7 @@ VALUE method_sereal_decode(VALUE self, VALUE args) {
195
195
  VALUE payload = rb_ary_shift(args);
196
196
  if (TYPE(payload) != T_STRING)
197
197
  rb_raise(rb_eTypeError,"can not decode objects of type %s",rb_obj_classname(payload));
198
-
198
+ u8 have_block = rb_block_given_p();
199
199
  sereal_t *s = s_create();
200
200
  u64 offset = 0;
201
201
  again:
@@ -269,14 +269,17 @@ again:
269
269
  }
270
270
 
271
271
  VALUE result = sereal_to_rb_object(s);
272
- if (is_compressed && rb_block_given_p()) {
272
+ if (is_compressed && have_block) {
273
273
  free(s->data);
274
274
  s->data = NULL;
275
275
  rb_yield(result);
276
276
  goto again;
277
277
  }
278
278
  s_destroy(s);
279
-
279
+ if (have_block) {
280
+ rb_yield(result);
281
+ return Qnil;
282
+ }
280
283
  return result;
281
284
  }
282
285
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sereal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Borislav Nikolov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-18 00:00:00.000000000 Z
11
+ date: 2013-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake-compiler
@@ -26,7 +26,8 @@ dependencies:
26
26
  version: '0'
27
27
  description: Sereal encoder/decoder (https://github.com/Sereal/Sereal)
28
28
  email: jack@sofialondonmoskva.com
29
- executables: []
29
+ executables:
30
+ - rsrl
30
31
  extensions:
31
32
  - ext/sereal/extconf.rb
32
33
  extra_rdoc_files: []
@@ -54,6 +55,7 @@ files:
54
55
  - ext/sereal/proto.h
55
56
  - ext/sereal/encode.h
56
57
  - ext/sereal/extconf.rb
58
+ - bin/rsrl
57
59
  homepage: https://github.com/Sereal/Sereal
58
60
  licenses: []
59
61
  metadata: {}