mochilo 1.0 → 1.1

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,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- OTMzOGM2MTMxMWI0YjZlNjZlMzhjNGU2ZDUyOWJmMWQyNGQ1OWJmZg==
5
- data.tar.gz: !binary |-
6
- YjdjODY4NDYyNWRhNGE2ODBiMTU4N2YwM2MwN2I0YWEyNzc0MjE0MA==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- MTQ5OTExMDNiMTM1MDVkODVlYTA3MDgzNGUwYzU5MGQ5OWE4MDBmY2E1Y2I5
10
- NWNhOGU3MzVjOTVhYzIwZGZkMTBmYTNkZDk5Y2Y4NWI3YWE4NWEwZjljMGNk
11
- ODhiY2MxNTY2ZjdlMjhmNmI2MTE5M2E1ZmY1MTExNjQ0M2Q5YTg=
12
- data.tar.gz: !binary |-
13
- NWNjMzNmMDU1YTM2ZGMwZGRhZWFhZDk0NzQ5NmYxNzkzMTcwNWNjOGY5OWUy
14
- MTliZmJkYWU1ZGYxOThlNzJhMjc4NDAzNDY2M2E0ZGNhZmM1Y2YzMzA5ODFi
15
- OGYwZDA4YTQzNmNiNzMxNmY1YjZmYjNmOTczYmU4MzdhOTBmNDk=
2
+ SHA1:
3
+ metadata.gz: cab1fe4d6e48774885abd85fccf875cd4a5c6e0c
4
+ data.tar.gz: da30bd8b80d4f1814603ee79d3eb7e9a26fa471f
5
+ SHA512:
6
+ metadata.gz: ea8c3721d85561ec7008a1bf5b06985dbae2829dcf6d1976bd21e4c82f47664735200915898490aaf2db1284d9654104a7718fcde0d95f119aa74268e87551b4
7
+ data.tar.gz: 99d4ddc0bbe85b2c091b168a3f71057d5aa4b41c7e714ee9235d98e8eb9bb875818f5341b73da0b8c848aecd7b2b71be89486a138f72584b64c0645774b24555
@@ -0,0 +1,7 @@
1
+ language: ruby
2
+ script:
3
+ - bundle exec rake test
4
+ rvm:
5
+ - 1.9.3
6
+ - 2.0.0
7
+ - 2.1.2
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mochilo (1.0)
4
+ mochilo (1.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2013 Brian Lopez - http://github.com/brianmario
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -219,113 +219,59 @@ void mochilo_pack_array(mochilo_buf *buf, VALUE rb_array, int trusted)
219
219
 
220
220
  void mochilo_pack_one(mochilo_buf *buf, VALUE rb_object, int trusted)
221
221
  {
222
- #ifndef RUBINIUS
223
- if (rb_object == Qnil) {
222
+ switch (rb_type(rb_object)) {
223
+ case T_NIL:
224
224
  mochilo_buf_putc(buf, MSGPACK_T_NIL);
225
- }
226
- else if (rb_object == Qtrue) {
225
+ return;
226
+
227
+ case T_TRUE:
227
228
  mochilo_buf_putc(buf, MSGPACK_T_TRUE);
228
- }
229
- else if (rb_object == Qfalse) {
229
+ return;
230
+
231
+ case T_FALSE:
230
232
  mochilo_buf_putc(buf, MSGPACK_T_FALSE);
231
- }
232
- else if (FIXNUM_P(rb_object)) {
233
+ return;
234
+
235
+ case T_FIXNUM:
233
236
  mochilo_pack_fixnum(buf, rb_object);
234
- }
235
- else if (SYMBOL_P(rb_object)) {
237
+ return;
238
+
239
+ case T_SYMBOL:
236
240
  if (trusted)
237
241
  mochilo_pack_symbol(buf, rb_object);
238
242
  else
239
243
  mochilo_pack_str(buf, rb_obj_as_string(rb_object));
240
- }
241
- else {
242
- switch (BUILTIN_TYPE(rb_object)) {
243
- case T_STRING:
244
- #ifdef HAVE_RUBY_ENCODING_H
245
- if (ENCODING_GET(rb_object) != 0)
246
- mochilo_pack_str(buf, rb_object);
247
- else
248
- #endif
249
- mochilo_pack_bytes(buf, rb_object);
250
- return;
244
+ return;
251
245
 
252
- case T_HASH:
253
- mochilo_pack_hash(buf, rb_object, trusted);
254
- return;
255
-
256
- case T_ARRAY:
257
- mochilo_pack_array(buf, rb_object, trusted);
258
- return;
259
-
260
- case T_FLOAT:
261
- mochilo_pack_double(buf, rb_object);
262
- return;
263
-
264
- case T_BIGNUM:
265
- mochilo_pack_bignum(buf, rb_object);
266
- return;
267
-
268
- default:
269
- rb_raise(rb_eMochiloPackError,
270
- "Unsupported object type: %s", rb_obj_classname(rb_object));
271
- return;
272
- }
273
- }
274
- #else // RUBINIUS
275
- switch (rb_type(rb_object)) {
276
- case T_NIL:
277
- mochilo_buf_putc(buf, MSGPACK_T_NIL);
278
- return;
279
-
280
- case T_FALSE:
281
- mochilo_buf_putc(buf, MSGPACK_T_FALSE);
282
- return;
283
-
284
- case T_TRUE:
285
- mochilo_buf_putc(buf, MSGPACK_T_TRUE);
286
- return;
287
-
288
- case T_FIXNUM:
289
- mochilo_pack_fixnum(buf, rb_object);
290
- return;
291
-
292
- case T_BIGNUM:
293
- mochilo_pack_bignum(buf, rb_object);
294
- return;
295
-
296
- case T_SYMBOL:
297
- if (trusted)
298
- mochilo_pack_symbol(buf, rb_object);
299
- else
300
- mochilo_pack_str(buf, rb_obj_as_string(rb_object));
301
- return;
302
-
303
- case T_STRING:
246
+ case T_STRING:
304
247
  #ifdef HAVE_RUBY_ENCODING_H
305
- if (ENCODING_GET(rb_object) != 0)
306
- mochilo_pack_str(buf, rb_object);
307
- else
248
+ if (ENCODING_GET(rb_object) != 0)
249
+ mochilo_pack_str(buf, rb_object);
250
+ else
308
251
  #endif
309
- mochilo_pack_bytes(buf, rb_object);
310
- return;
252
+ mochilo_pack_bytes(buf, rb_object);
253
+ return;
311
254
 
312
- case T_HASH:
313
- mochilo_pack_hash(buf, rb_object, trusted);
314
- return;
255
+ case T_HASH:
256
+ mochilo_pack_hash(buf, rb_object, trusted);
257
+ return;
315
258
 
316
- case T_ARRAY:
317
- mochilo_pack_array(buf, rb_object, trusted);
318
- return;
259
+ case T_ARRAY:
260
+ mochilo_pack_array(buf, rb_object, trusted);
261
+ return;
319
262
 
320
- case T_FLOAT:
321
- mochilo_pack_double(buf, rb_object);
322
- return;
263
+ case T_FLOAT:
264
+ mochilo_pack_double(buf, rb_object);
265
+ return;
323
266
 
324
- default:
325
- rb_raise(rb_eMochiloPackError,
267
+ case T_BIGNUM:
268
+ mochilo_pack_bignum(buf, rb_object);
269
+ return;
270
+
271
+ default:
272
+ rb_raise(rb_eMochiloPackError,
326
273
  "Unsupported object type: %s", rb_obj_classname(rb_object));
327
- return;
274
+ return;
328
275
  }
329
- #endif
330
276
  }
331
277
 
@@ -1,3 +1,3 @@
1
1
  module Mochilo
2
- VERSION = "1.0"
2
+ VERSION = "1.1"
3
3
  end
@@ -14,6 +14,7 @@ Gem::Specification.new do |s|
14
14
  s.rubygems_version = %q{1.4.2}
15
15
  s.summary = %q{A ruby library for BananaPack}
16
16
  s.test_files = `git ls-files spec`.split("\n")
17
+ s.required_ruby_version = ">= 1.9.3"
17
18
 
18
19
  # tests
19
20
  s.add_development_dependency 'rake-compiler', ">= 0.8.1"
@@ -21,4 +22,3 @@ Gem::Specification.new do |s|
21
22
  # benchmarks
22
23
  s.add_development_dependency 'msgpack'
23
24
  end
24
-
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.0'
4
+ version: '1.1'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vicent Martí
@@ -9,48 +9,48 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-17 00:00:00.000000000 Z
12
+ date: 2014-10-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake-compiler
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ! '>='
18
+ - - ">="
19
19
  - !ruby/object:Gem::Version
20
20
  version: 0.8.1
21
21
  type: :development
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ! '>='
25
+ - - ">="
26
26
  - !ruby/object:Gem::Version
27
27
  version: 0.8.1
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: minitest
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - ! '>='
32
+ - - ">="
33
33
  - !ruby/object:Gem::Version
34
34
  version: 4.1.0
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ! '>='
39
+ - - ">="
40
40
  - !ruby/object:Gem::Version
41
41
  version: 4.1.0
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: msgpack
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - ! '>='
46
+ - - ">="
47
47
  - !ruby/object:Gem::Version
48
48
  version: '0'
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - ! '>='
53
+ - - ">="
54
54
  - !ruby/object:Gem::Version
55
55
  version: '0'
56
56
  description:
@@ -60,9 +60,11 @@ extensions:
60
60
  - ext/mochilo/extconf.rb
61
61
  extra_rdoc_files: []
62
62
  files:
63
- - .gitignore
63
+ - ".gitignore"
64
+ - ".travis.yml"
64
65
  - Gemfile
65
66
  - Gemfile.lock
67
+ - MIT-LICENSE
66
68
  - README.md
67
69
  - Rakefile
68
70
  - docs/format-spec.md
@@ -94,22 +96,22 @@ licenses: []
94
96
  metadata: {}
95
97
  post_install_message:
96
98
  rdoc_options:
97
- - --charset=UTF-8
99
+ - "--charset=UTF-8"
98
100
  require_paths:
99
101
  - lib
100
102
  required_ruby_version: !ruby/object:Gem::Requirement
101
103
  requirements:
102
- - - ! '>='
104
+ - - ">="
103
105
  - !ruby/object:Gem::Version
104
- version: '0'
106
+ version: 1.9.3
105
107
  required_rubygems_version: !ruby/object:Gem::Requirement
106
108
  requirements:
107
- - - ! '>='
109
+ - - ">="
108
110
  - !ruby/object:Gem::Version
109
111
  version: '0'
110
112
  requirements: []
111
113
  rubyforge_project:
112
- rubygems_version: 2.0.6
114
+ rubygems_version: 2.2.2
113
115
  signing_key:
114
116
  specification_version: 4
115
117
  summary: A ruby library for BananaPack