Added the -globalmodule command-line option for the Ruby module, which

allows the user to wrap all classes, methods and constants directly into
the global module (i.e. the Kernel module) instead of a named, nested
module.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@4706 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Logan Johnson 2003-04-25 16:03:50 +00:00
commit 0805ba938d
4 changed files with 27 additions and 9 deletions

View file

@ -92,6 +92,7 @@ static const char *
usage = "\
Ruby Options (available with -ruby)\n\
-ldflags - Print runtime libraries to link with\n\
-globalmodule - Wrap everything into the global module\n\
-feature name - Set feature name (used by `require')\n";
@ -177,6 +178,9 @@ public:
} else {
Swig_arg_error();
}
} else if (strcmp(argv[i],"-globalmodule") == 0) {
useGlobalModule = true;
Swig_mark_arg(i);
} else if (strcmp(argv[i],"-help") == 0) {
Printf(stderr,"%s\n", usage);
} else if (strcmp (argv[i],"-ldflags") == 0) {
@ -1330,7 +1334,7 @@ public:
Printv(klass->init, klass->vname, " = rb_define_class_under(", modvar,
", \"", klass->name, "\", $super);\n", NIL);
} else {
Printv(klass->init, klass->vname, " = rb_define_class_under(\"",
Printv(klass->init, klass->vname, " = rb_define_class(\"",
klass->name, "\", $super);\n", NIL);
}