sereal 0.0.4 → 0.0.5
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/bin/rsrl +18 -0
- data/ext/sereal/decode.c +6 -3
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bac669b1c7ac841a45408831331a217d124f0214
|
4
|
+
data.tar.gz: 36d8e97569db8dd83488cdc6814509865d065767
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec82fea24d7ea01a8499df9b479f9637a162d7d97f2fe523202ce2238fa9a0f474fff88c76475c6c2a28d7a44031fcc5a789c95dc8baa31741971b79c0987306
|
7
|
+
data.tar.gz: e6e8447c22300cee2d630fd0237c59f3145605cb47c8ca1cf4263c92a45249b28f5f51944f17dbc382724a2e378af3583575221218f11d369c5270a459c32fc1
|
data/bin/rsrl
ADDED
@@ -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
|
data/ext/sereal/decode.c
CHANGED
@@ -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 &&
|
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
|
+
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-
|
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: {}
|