summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--ext/strscan/strscan.c8
2 files changed, 14 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index aa58782..a44c523 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,13 @@
+Thu Feb 19 02:42:19 2004 Minero Aoki <aamine@loveruby.net>
+
+ * ext/strscan/strscan.c: don't use rb_eval_string, it defines
+ classes under the module when required in module clauses.
+ [ruby-dev:22951]
+
Thu Feb 19 02:37:28 2004 Minero Aoki <aamine@loveruby.net>
- * ext/strscan/strscan.c: merge documentation from 1.8 branch. Thanks Gavin Sinclair.
+ * ext/strscan/strscan.c: merge documentation from 1.8 branch.
+ Thanks Gavin Sinclair.
Wed Feb 19 00:20:00 2004 Gavin Sinclair <gsinclair@soyabean.com.au>
diff --git a/ext/strscan/strscan.c b/ext/strscan/strscan.c
index 39d3d8b..8997cbf 100644
--- a/ext/strscan/strscan.c
+++ b/ext/strscan/strscan.c
@@ -1245,10 +1245,14 @@ inspect2(p)
void
Init_strscan()
{
- volatile VALUE tmp;
+ ID id_scanerr = rb_intern("ScanError");
+ VALUE tmp;
StringScanner = rb_define_class("StringScanner", rb_cObject);
- ScanError = rb_eval_string("class StringScanner; class Error < StandardError; end; end; ScanError = StringScanner::Error unless defined?(ScanError); StringScanner::Error");
+ ScanError = rb_define_class_under(StringScanner, "Error", rb_eStandardError);
+ if (!rb_const_defined(rb_cObject, id_scanerr)) {
+ rb_const_set(rb_cObject, id_scanerr, ScanError);
+ }
tmp = rb_str_new2(STRSCAN_VERSION);
rb_obj_freeze(tmp);
rb_const_set(StringScanner, rb_intern("Version"), tmp);