mochilo 1.1 → 1.2
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/.travis.yml +4 -2
- data/Gemfile.lock +4 -1
- data/ext/mochilo/mochilo_pack.c +8 -3
- data/lib/mochilo/version.rb +1 -1
- data/mochilo.gemspec +1 -1
- data/test/pack_test.rb +6 -0
- data/test/setup.rb +9 -0
- metadata +8 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 64991c41216b4fb7659230eb433f7cb6c3f4ffff
|
4
|
+
data.tar.gz: 21e5f81fdf2be02ad17303ca98636020fa2f8f78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8258d48406e1674370d61cf42562db462908a6239f8471f2033a157bc4547fe4e7793d74a516046f6326d4473e73162be9b467b35f4e6fe55f43aa09c763fec7
|
7
|
+
data.tar.gz: 4e44d9ab0960cadaa4b70c15c1da0b2b10447dfe3790f80189d6ee70f697966b52bdbb9ae9546b446f7bfa860274efb8cd212f80ca26c858ddc1ad8850fc1f66
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
data/ext/mochilo/mochilo_pack.c
CHANGED
@@ -269,9 +269,14 @@ void mochilo_pack_one(mochilo_buf *buf, VALUE rb_object, int trusted)
|
|
269
269
|
return;
|
270
270
|
|
271
271
|
default:
|
272
|
-
|
273
|
-
|
272
|
+
if (rb_respond_to(rb_object, rb_intern("to_bpack"))) {
|
273
|
+
VALUE bpack = rb_funcall(rb_object, rb_intern("to_bpack"), 0);
|
274
|
+
|
275
|
+
mochilo_buf_put(buf, RSTRING_PTR(bpack), RSTRING_LEN(bpack));
|
276
|
+
} else {
|
277
|
+
rb_raise(rb_eMochiloPackError,
|
278
|
+
"Unsupported object type: %s", rb_obj_classname(rb_object));
|
279
|
+
}
|
274
280
|
return;
|
275
281
|
}
|
276
282
|
}
|
277
|
-
|
data/lib/mochilo/version.rb
CHANGED
data/mochilo.gemspec
CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
|
|
13
13
|
s.require_paths = ["lib"]
|
14
14
|
s.rubygems_version = %q{1.4.2}
|
15
15
|
s.summary = %q{A ruby library for BananaPack}
|
16
|
-
s.test_files = `git ls-files
|
16
|
+
s.test_files = `git ls-files test`.split("\n")
|
17
17
|
s.required_ruby_version = ">= 1.9.3"
|
18
18
|
|
19
19
|
# tests
|
data/test/pack_test.rb
CHANGED
@@ -164,6 +164,12 @@ class MochiloPackTest < MiniTest::Unit::TestCase
|
|
164
164
|
# TODO: not sure how to test this without making a massive 66k item hash
|
165
165
|
end
|
166
166
|
|
167
|
+
def test_pack_custom_type
|
168
|
+
obj = CustomType.new("custom")
|
169
|
+
|
170
|
+
assert_equal "\xA6custom", Mochilo.pack(obj)
|
171
|
+
end
|
172
|
+
|
167
173
|
def test_pack_unsupported_type
|
168
174
|
assert_raises Mochilo::PackError do
|
169
175
|
Mochilo.pack(Object.new)
|
data/test/setup.rb
CHANGED
@@ -14,3 +14,12 @@ require 'minitest/autorun'
|
|
14
14
|
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
15
15
|
$LOAD_PATH.unshift File.expand_path('..', __FILE__)
|
16
16
|
|
17
|
+
class CustomType
|
18
|
+
def initialize(str)
|
19
|
+
@str = str
|
20
|
+
end
|
21
|
+
|
22
|
+
def to_bpack
|
23
|
+
Mochilo.pack(@str)
|
24
|
+
end
|
25
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mochilo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.2'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vicent Martí
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2016-03-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake-compiler
|
@@ -111,8 +111,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
111
111
|
version: '0'
|
112
112
|
requirements: []
|
113
113
|
rubyforge_project:
|
114
|
-
rubygems_version: 2.
|
114
|
+
rubygems_version: 2.5.1
|
115
115
|
signing_key:
|
116
116
|
specification_version: 4
|
117
117
|
summary: A ruby library for BananaPack
|
118
|
-
test_files:
|
118
|
+
test_files:
|
119
|
+
- test/assets/pulls.json
|
120
|
+
- test/pack_test.rb
|
121
|
+
- test/setup.rb
|
122
|
+
- test/unpack_test.rb
|