Skip to content
Browse files

fixed mimic_JSON to fake out Ruby

  • Loading branch information...
1 parent e3f3258 commit 647d36b0f553343fd8d71685ec7cd58d29c522ea Peter Ohler committed Aug 12, 2012
Showing with 8 additions and 3 deletions.
  1. +2 −2 README.md
  2. +5 −0 ext/oj/oj.c
  3. +1 −1 lib/oj/version.rb
View
4 README.md
@@ -32,9 +32,9 @@ A fast JSON parser and Object marshaller as a Ruby gem.
## <a name="release">Release Notes</a>
-### Release 1.3.2
+### Release 1.3.4
- - Fixed compile problems with native Ruby on OS X 10.8 (Mountain Lion)
+ - Fixed mimic_JSON so it convinces Ruby that the json gem is already loaded.
## <a name="description">Description</a>
View
5 ext/oj/oj.c
@@ -810,6 +810,11 @@ define_mimic_json(VALUE self) {
ext = rb_define_module_under(mimic, "Ext");
dummy = rb_define_class_under(ext, "Parser", rb_cObject);
dummy = rb_define_class_under(ext, "Generator", rb_cObject);
+ // convince Ruby that the json gem has already been loaded
+ dummy = rb_gv_get("$LOADED_FEATURES");
+ if (rb_type(dummy) == T_ARRAY) {
+ rb_ary_push(dummy, rb_str_new2("json"));
+ }
rb_define_module_function(mimic, "parser=", no_op1, 1);
rb_define_module_function(mimic, "generator=", no_op1, 1);
View
2 lib/oj/version.rb
@@ -1,5 +1,5 @@
module Oj
# Current version of the module.
- VERSION = '1.3.2'
+ VERSION = '1.3.4'
end

0 comments on commit 647d36b

Please sign in to comment.
Something went wrong with that request. Please try again.