Skip to content

Commit

Permalink
refine overriding 'require'.
Browse files Browse the repository at this point in the history
  • Loading branch information
xordog committed Mar 5, 2020
1 parent b024846 commit bb8a194
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/CRuby.m
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,11 @@ + (void)initialize
rb_define_module_function(mCRuby, "require_extension", require_extension, -1);

[self eval:@
"alias require_original require;"
"def require (*args)"
" CRuby.require_extension(*args) || require_original(*args);"
"module Kernel;"
" alias cruby_require__ require;"
" def require (*args);"
" CRuby.require_extension(*args) || cruby_require__(*args);"
" end;"];
"end"];
}

Expand Down

0 comments on commit bb8a194

Please sign in to comment.