summaryrefslogtreecommitdiff
path: root/re.c
diff options
context:
space:
mode:
Diffstat (limited to 're.c')
-rw-r--r--re.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/re.c b/re.c
index e9bcf11b31..f225a413d5 100644
--- a/re.c
+++ b/re.c
@@ -20,6 +20,7 @@
#include "internal/imemo.h"
#include "internal/re.h"
#include "internal/string.h"
+#include "internal/object.h"
#include "internal/ractor.h"
#include "internal/variable.h"
#include "regint.h"
@@ -3716,7 +3717,8 @@ rb_reg_initialize_m(int argc, VALUE *argv, VALUE self)
else {
if (opts != Qundef) {
if (FIXNUM_P(opts)) flags = FIX2INT(opts);
- else if (RTEST(opts)) flags = ONIG_OPTION_IGNORECASE;
+ else if (!NIL_P(opts) && rb_bool_expected(opts, "ignorecase", FALSE))
+ flags = ONIG_OPTION_IGNORECASE;
}
if (n_flag != Qundef && !NIL_P(n_flag)) {
char *kcode = StringValuePtr(n_flag);