summaryrefslogtreecommitdiff
path: root/lib/set.rb
diff options
context:
space:
mode:
authorAkinori MUSHA <knu@idaemons.org>2020-12-22 12:20:21 +0900
committerAkinori MUSHA <knu@idaemons.org>2020-12-22 12:20:21 +0900
commit3fa4bd82928983cf5f6711c130711502397e05e2 (patch)
treedb80a406ef9497d1e53ac26c43ffa275edf2e61e /lib/set.rb
parent63b872c409ec441718f55c60362a441cf108cfc0 (diff)
Import set 1.0.0
- SortedSet has been removed for dependency and performance reasons. - Set#join is added as a shorthand for `.to_a.join`. - Set#<=> is added. https://github.com/ruby/set/blob/v1.0.0/CHANGELOG.md
Diffstat (limited to 'lib/set.rb')
-rw-r--r--lib/set.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/set.rb b/lib/set.rb
index 625046d..2bd2a0f 100644
--- a/lib/set.rb
+++ b/lib/set.rb
@@ -641,6 +641,12 @@ class Set
end
end
+ # Returns a string created by converting each element of the set to a string
+ # See also: Array#join
+ def join(separator=nil)
+ to_a.join(separator)
+ end
+
InspectKey = :__inspect_key__ # :nodoc:
# Returns a string containing a human-readable representation of the
@@ -684,3 +690,5 @@ module Enumerable
klass.new(self, *args, &block)
end
end
+
+autoload :SortedSet, "#{__dir__}/set/sorted_set"