brotli 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 97953895465e26d5937e5959f86954aa58de2d2221301bc64ff639e682565605
4
- data.tar.gz: 4f26bccb546a19c743eea5b0fd9207f8e623bfd73f05e08f3dae275b76c51482
3
+ metadata.gz: bfcc8a08b7351d54f9472ca2b549733eac9d4be139c3ba9f1ebfe41c3f8fb057
4
+ data.tar.gz: 98764c09827125ba6304a6910a84e1674f4dcd6a3e13793b4438ea5c9a96f815
5
5
  SHA512:
6
- metadata.gz: b5e79aee2804a948da509247c56b1f79e9248927ec6430319b1d2b6202973ed41bca1ceba215f8d4954ad98a52637a91e49bfa316af4ab3d35fcb779f0e94aa3
7
- data.tar.gz: 46d42e9297f79aef7481b068e43da47c60d45b0f781a0ceb1fc7626cdb9c59bc306feaab0b05321cba17e23256e492814f340725db8fb21dc9e4c84198507bf5
6
+ metadata.gz: d24c3f2595c9578a71e9d1a3208bcd74e95197e17f796ba3df72dd36818189a0838e79b9ae5ffcf668f258718a2c260142866e419993b4282bada394199d025b
7
+ data.tar.gz: 891d4714d76a902d38898e9287063e97e8161be0f4e7af3f91477af5a7412c25d73b881dbd0d1031457458a69b3c4f0b466ab953a519318664acd3332c057fb7
data/ext/brotli/brotli.c CHANGED
@@ -68,12 +68,18 @@ brotli_inflate_no_gvl(void *arg)
68
68
  return arg;
69
69
  }
70
70
 
71
+ static ID id_read;
72
+
71
73
  static VALUE
72
74
  brotli_inflate(VALUE self, VALUE str)
73
75
  {
74
76
  VALUE value = Qnil;
75
77
  brotli_inflate_args_t args;
76
78
 
79
+ if (rb_respond_to(str, id_read)) {
80
+ str = rb_funcall(str, id_read, 0, 0);
81
+ }
82
+
77
83
  StringValue(str);
78
84
 
79
85
  args.str = (uint8_t*)RSTRING_PTR(str);
@@ -472,6 +478,7 @@ Init_brotli(void)
472
478
  rb_define_singleton_method(rb_mBrotli, "deflate", RUBY_METHOD_FUNC(brotli_deflate), -1);
473
479
  rb_define_singleton_method(rb_mBrotli, "inflate", RUBY_METHOD_FUNC(brotli_inflate), 1);
474
480
  rb_define_singleton_method(rb_mBrotli, "version", RUBY_METHOD_FUNC(brotli_version), 0);
481
+ id_read = rb_intern("read");
475
482
  // Brotli::Writer
476
483
  id_write = rb_intern("write");
477
484
  id_flush = rb_intern("flush");
@@ -1,3 +1,3 @@
1
1
  module Brotli
2
- VERSION = '0.5.0'
2
+ VERSION = '0.6.0'
3
3
  end
data/test/brotli_test.rb CHANGED
@@ -77,6 +77,16 @@ class BrotliTest < Test::Unit::TestCase
77
77
  assert_equal testdata, Brotli.inflate(testdata2)
78
78
  end
79
79
 
80
+ test "works with StringIO" do
81
+ testdata3 = StringIO.new testdata2
82
+ assert_equal testdata, Brotli.inflate(testdata3)
83
+ end
84
+
85
+ test "works with File" do
86
+ f = File.open(File.expand_path(File.join("..", "vendor", "brotli", "tests", "testdata", "alice29.txt.compressed"), __dir__))
87
+ assert_equal testdata, Brotli.inflate(f)
88
+ end
89
+
80
90
  test "raise error when pass insufficient data" do
81
91
  assert_raise Brotli::Error do
82
92
  Brotli.inflate(testdata2[0, 64])
data/test/test_helper.rb CHANGED
@@ -6,3 +6,4 @@ require "brotli"
6
6
  require "test-unit"
7
7
  require "test/unit/rr"
8
8
  require "rantly/testunit_extensions"
9
+ require "stringio"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brotli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - miyucy
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-01-31 00:00:00.000000000 Z
11
+ date: 2024-08-20 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Brotli compressor/decompressor
14
14
  email:
@@ -155,7 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
155
155
  - !ruby/object:Gem::Version
156
156
  version: '0'
157
157
  requirements: []
158
- rubygems_version: 3.5.3
158
+ rubygems_version: 3.5.11
159
159
  signing_key:
160
160
  specification_version: 4
161
161
  summary: Brotli compressor/decompressor