-
-
Save headius/0cffb9caa668f86b9c12601dbdf0bbde to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/core/src/main/java/org/jruby/ext/strscan/RubyStringScanner.java b/core/src/main/java/org/jruby/ext/strscan/RubyStringScanner.java | |
index 7b150c67ef..bc4453d355 100644 | |
--- a/core/src/main/java/org/jruby/ext/strscan/RubyStringScanner.java | |
+++ b/core/src/main/java/org/jruby/ext/strscan/RubyStringScanner.java | |
@@ -246,7 +246,7 @@ public class RubyStringScanner extends RubyObject { | |
}; | |
private IRubyObject scan(ThreadContext context, IRubyObject regex, boolean succptr, boolean getstr, boolean headonly) { | |
- final Ruby runtime = getRuntime(); | |
+ final Ruby runtime = context.runtime; | |
if (!(regex instanceof RubyRegexp)) throw runtime.newTypeError("wrong argument type " + regex.getMetaClass() + " (expected Regexp)"); | |
check(); | |
@@ -438,9 +438,12 @@ public class RubyStringScanner extends RubyObject { | |
} | |
@JRubyMethod(name = "unscan") | |
- public IRubyObject unscan() { | |
+ public IRubyObject unscan(ThreadContext context) { | |
+ return unscan(context.runtime); | |
+ } | |
+ | |
+ private IRubyObject unscan(Ruby runtime) { | |
check(); | |
- Ruby runtime = getRuntime(); | |
if (!isMatched()) { | |
RubyClass errorClass = runtime.getClass("StringScanner").getClass("Error"); | |
@@ -451,6 +454,11 @@ public class RubyStringScanner extends RubyObject { | |
return this; | |
} | |
+ @Deprecated | |
+ public IRubyObject unscan() { | |
+ return unscan(getRuntime()); | |
+ } | |
+ | |
@JRubyMethod(name = "beginning_of_line?", alias = "bol?") | |
public IRubyObject bol_p() { | |
check(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment