Skip to content

Instantly share code, notes, and snippets.

@haileys
Created February 14, 2014 04:43
Show Gist options
  • Save haileys/8995941 to your computer and use it in GitHub Desktop.
Save haileys/8995941 to your computer and use it in GitHub Desktop.
turn top level constant references into exceptions rather than warnings
diff --git variable.c variable.c
index d142255..27b1237 100644
--- variable.c
+++ variable.c
@@ -1851,7 +1851,7 @@ rb_const_get_0(VALUE klass, ID id, int exclude, int recurse, int visibility)
continue;
}
if (exclude && tmp == rb_cObject && klass != rb_cObject) {
- rb_warn("toplevel constant %"PRIsVALUE" referenced by %"PRIsVALUE"::%"PRIsVALUE"",
+ rb_raise(rb_eNameError, "toplevel constant %"PRIsVALUE" referenced by %"PRIsVALUE"::%"PRIsVALUE"",
QUOTE_ID(id), rb_class_name(klass), QUOTE_ID(id));
}
return value;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment