Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix String#chomp! without argument

String#chomp! should depend on $/ as String#chomp.
  • Loading branch information...
commit a92e430361aed78de55107b4c23336c534380630 1 parent 9a0b445
@kachick authored
Showing with 4 additions and 4 deletions.
  1. +2 −2 kernel/common/string18.rb
  2. +2 −2 kernel/common/string19.rb
View
4 kernel/common/string18.rb
@@ -233,9 +233,9 @@ def chop!
# NOTE: TypeError is raised in String#replace and not in String#chomp! when
# self is frozen. This is intended behaviour.
- def chomp!(sep=undefined)
+ def chomp!(sep=$/)
# special case for performance. No seperator is by far the most common usage.
- if sep.equal?(undefined)
+ if sep == DEFAULT_RECORD_SEPARATOR
return if @num_bytes == 0
Rubinius.check_frozen
View
4 kernel/common/string19.rb
@@ -497,11 +497,11 @@ def chop!
# NOTE: TypeError is raised in String#replace and not in String#chomp! when
# self is frozen. This is intended behaviour.
- def chomp!(sep=undefined)
+ def chomp!(sep=$/)
Rubinius.check_frozen
# special case for performance. No seperator is by far the most common usage.
- if sep.equal?(undefined)
+ if sep == DEFAULT_RECORD_SEPARATOR
return if @num_bytes == 0
c = @data[@num_bytes-1]

0 comments on commit a92e430

Please sign in to comment.
Something went wrong with that request. Please try again.