-
Notifications
You must be signed in to change notification settings - Fork 43
StringScanner#captures: Return nil not "" for unmached capture #72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -901,9 +901,14 @@ public IRubyObject captures(ThreadContext context) { | |
| newAry = RubyArray.newArray(runtime, numRegs); | ||
|
|
||
| for (i = 1; i < numRegs; i++) { | ||
| IRubyObject str = extractRange(runtime, | ||
| IRubyObject str; | ||
| if (REGION_ADAPTER.getBeg(regs, i) == -1) { | ||
| str = context.nil; | ||
| } else { | ||
| str = extractRange(runtime, | ||
| adjustRegisterPosition(REGION_ADAPTER.getBeg(regs, i)), | ||
| adjustRegisterPosition(REGION_ADAPTER.getEnd(regs, i))); | ||
|
Comment on lines
909
to
910
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @headius Should we indent them?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll merge this. If we need to fix style here, we can do it as a follow-up PR.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We generally just try to match existing style when making other changes. We can do a separate PR to clean up formatting. |
||
| } | ||
| newAry.push(str); | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.