Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: opal/opal
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: d58fda2d9fc2
Choose a base ref
...
head repository: opal/opal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 4f5cfb12cf89
Choose a head ref
  • 2 commits
  • 1 file changed
  • 2 contributors

Commits on Feb 28, 2015

  1. Copy the full SHA
    a71ee28 View commit details

Commits on Mar 3, 2015

  1. Merge pull request #714 from vais/issue571

    String#scan: use MatchData captures to deal with undefined values
    meh committed Mar 3, 2015
    Copy the full SHA
    4f5cfb1 View commit details
Showing with 3 additions and 4 deletions.
  1. +3 −4 opal/corelib/string.rb
7 changes: 3 additions & 4 deletions opal/corelib/string.rb
Original file line number Diff line number Diff line change
@@ -703,10 +703,9 @@ def scan(pattern, &block)
while ((match = pattern.exec(self)) != null) {
var match_data = #{MatchData.new `pattern`, `match`};
if (block === nil) {
match.length == 1 ? result.push(match[0]) : result.push(match.slice(1));
}
else {
match.length == 1 ? block(match[0]) : block.apply(self, match.slice(1));
match.length == 1 ? result.push(match[0]) : result.push(#{`match_data`.captures});
} else {
match.length == 1 ? block(match[0]) : block.apply(self, #{`match_data`.captures});
}
}