Skip to content

Commit

Permalink
remove reimplementations of #to_s for core collection classes
Browse files Browse the repository at this point in the history
It's basically buggy, and not needed since 1.9. It was really a 1.8
thing.
  • Loading branch information
doudou committed Nov 12, 2015
1 parent 04dde7a commit bcf4e83
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 35 deletions.
12 changes: 0 additions & 12 deletions lib/utilrb/array/to_s.rb
Original file line number Diff line number Diff line change
@@ -1,12 +0,0 @@
require 'utilrb/enumerable/to_s_helper'
class Array
# Displays arrays as [ a, b, [c, d], ... ] instead of the standard #join
# Unlike #inspect, it calls #to_s on the elements too
undef_method :to_s
def to_s
EnumerableToString.to_s_helper(self, '[', ']') do |obj|
obj.to_s
end
end
end

12 changes: 0 additions & 12 deletions lib/utilrb/hash/to_s.rb
Original file line number Diff line number Diff line change
@@ -1,12 +0,0 @@
require 'utilrb/enumerable/to_s_helper'
class Hash
# Displays hashes as { a => A, b => B, ... } instead of the standard #join
# Unlike #inspect, it calls #to_s on the elements too
undef_method :to_s
def to_s
EnumerableToString.to_s_helper(self, '{', '}') do |k, v|
"#{k} => #{v}"
end
end
end

11 changes: 0 additions & 11 deletions lib/utilrb/set/to_s.rb
Original file line number Diff line number Diff line change
@@ -1,11 +0,0 @@
require 'utilrb/enumerable/to_s_helper'
require 'set'
class Set
# Displays the set as {a, b, c, d}
def to_s
EnumerableToString.to_s_helper(self, '{', '}') do |obj|
obj.to_s
end
end
end

0 comments on commit bcf4e83

Please sign in to comment.