Created
August 11, 2009 10:15
-
-
Save methodmissing/165736 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| static int | |
| rb_const_defined_0(klass, id, exclude, recurse) | |
| VALUE klass; | |
| ID id; | |
| int exclude, recurse; | |
| { | |
| VALUE value, tmp; | |
| int mod_retry = 0; | |
| tmp = klass; | |
| retry: | |
| while (tmp) { | |
| if (RCLASS(tmp)->iv_tbl && st_lookup(RCLASS(tmp)->iv_tbl, id, &value)) { | |
| if (value == Qundef && NIL_P(autoload_file(klass, id))) | |
| return Qfalse; | |
| return Qtrue; | |
| } | |
| if (!recurse && klass != rb_cObject) break; | |
| tmp = RCLASS(tmp)->super; | |
| } | |
| if (!exclude && !mod_retry && BUILTIN_TYPE(klass) == T_MODULE) { | |
| mod_retry = 1; | |
| tmp = rb_cObject; | |
| goto retry; | |
| } | |
| return Qfalse; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment