Skip to content

Commit 6f39ff8

Browse files
authored
Merge pull request #165 from hsbt/support-ruby24
Support to Integer unification for Ruby 2.4
2 parents 0a1882d + 4bf7a75 commit 6f39ff8

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ rvm:
88
- rbx-2
99
- ree
1010
- ruby-head
11+
before_install: gem install bundler --no-document
1112
matrix:
1213
allow_failures:
1314
- rvm: rbx-2

ext/yajl/yajl_ext.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,11 @@ static VALUE rb_yajl_json_ext_nil_to_json(int argc, VALUE * argv, VALUE self) {
878878
static VALUE rb_yajl_encoder_enable_json_gem_ext(VALUE klass) {
879879
rb_define_method(rb_cHash, "to_json", rb_yajl_json_ext_hash_to_json, -1);
880880
rb_define_method(rb_cArray, "to_json", rb_yajl_json_ext_array_to_json, -1);
881+
#ifdef RUBY_INTEGER_UNIFICATION
882+
rb_define_method(rb_cInteger, "to_json", rb_yajl_json_ext_fixnum_to_json, -1);
883+
#else
881884
rb_define_method(rb_cFixnum, "to_json", rb_yajl_json_ext_fixnum_to_json, -1);
885+
#endif
882886
rb_define_method(rb_cFloat, "to_json", rb_yajl_json_ext_float_to_json, -1);
883887
rb_define_method(rb_cString, "to_json", rb_yajl_json_ext_string_to_json, -1);
884888
rb_define_method(rb_cTrueClass, "to_json", rb_yajl_json_ext_true_to_json, -1);

0 commit comments

Comments
 (0)