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: rubinius/rubinius
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 07f71e42748b
Choose a base ref
...
head repository: rubinius/rubinius
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 64f69d322437
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on Dec 24, 2014

  1. Removed spec tags for String#scrub.

    Yorick Peterse committed Dec 24, 2014
    Copy the full SHA
    4ff363a View commit details
  2. Fixed String#scrub with custom block encodings.

    String#force_encoding is truly a magical piece of engineering, it makes all our
    encoding problems go away!
    Yorick Peterse committed Dec 24, 2014
    Copy the full SHA
    64f69d3 View commit details
Showing with 5 additions and 2 deletions.
  1. +5 −1 kernel/common/string.rb
  2. +0 −1 spec/tags/ruby/core/string/scrub_tags.txt
6 changes: 5 additions & 1 deletion kernel/common/string.rb
Original file line number Diff line number Diff line change
@@ -1957,8 +1957,12 @@ def scrub(replace = nil)
elsif result == :undefined_conversion
output << converter.primitive_errinfo[3]
else
# Blocks can return strings in any encoding so we'll make sure it's the
# same as our buffer for the mean time.
if block_given?
output << yield(converter.primitive_errinfo[3])
block_output = yield(converter.primitive_errinfo[3])

output << block_output.force_encoding(output.encoding)
else
output << replace
end
1 change: 0 additions & 1 deletion spec/tags/ruby/core/string/scrub_tags.txt

This file was deleted.