From f6f453438242fe724dcf0d2d5c968a5861820848 Mon Sep 17 00:00:00 2001 From: naruse Date: Wed, 30 Nov 2011 14:44:06 +0000 Subject: * variable.c (rb_path2class): don't raise NameError when the middle constant of the path is not defined but defined on toplevel. [ruby-core:41410] [Bug #5691] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33909 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/-test-/path_to_class/extconf.rb | 6 ++++++ ext/-test-/path_to_class/path_to_class.c | 9 +++++++++ 2 files changed, 15 insertions(+) create mode 100644 ext/-test-/path_to_class/extconf.rb create mode 100644 ext/-test-/path_to_class/path_to_class.c (limited to 'ext/-test-/path_to_class') diff --git a/ext/-test-/path_to_class/extconf.rb b/ext/-test-/path_to_class/extconf.rb new file mode 100644 index 0000000000..e1072b1443 --- /dev/null +++ b/ext/-test-/path_to_class/extconf.rb @@ -0,0 +1,6 @@ +$srcs = Dir[File.join($srcdir, "*.{#{SRC_EXT.join(%q{,})}}")] +inits = $srcs.map {|s| File.basename(s, ".*")} +inits.delete("init") +inits.map! {|s|"X(#{s})"} +$defs << "-DTEST_INIT_FUNCS(X)=\"#{inits.join(' ')}\"" +create_makefile("-test-/path_to_class/path_to_class") diff --git a/ext/-test-/path_to_class/path_to_class.c b/ext/-test-/path_to_class/path_to_class.c new file mode 100644 index 0000000000..9b88b48d40 --- /dev/null +++ b/ext/-test-/path_to_class/path_to_class.c @@ -0,0 +1,9 @@ +#include "ruby.h" + +void +Init_path_to_class(void) +{ + VALUE klass = rb_path2class("Test_PathToClass"); + + rb_define_singleton_method(klass, "path_to_class", rb_path_to_class, 1); +} -- cgit v1.2.3