sorted_set 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e56f60064165312509fe6eba771c978f17b1ec0a9e7fa48ca9507e5e8859d8cf
4
- data.tar.gz: 8d04402fb56428ea45bf43255112b7b4ddfab075a923efc9933c882cabc9812c
3
+ metadata.gz: b608cd727ba5db1ff4a6075bf8019f08df9b33e84ec81bb92a86f2370f91a690
4
+ data.tar.gz: 80812b5f265029471600b44cea9b390ae2a2b92a596e01f39c09e50f4609d7fd
5
5
  SHA512:
6
- metadata.gz: 815254e15bf0889c57f831795792761a1d14c8f8c6420b88c8c967fbf6e60dae9938f450ecb00d9daa201729eb173f3631b2fb8531d289d900dc91d9010850e0
7
- data.tar.gz: 9a7e2c54b2c414d0bcffa55059304813af6da28f607fbabaad07967211af529df94d4f56036d5d4a60895acb51bfa1fcae8fa90810ae7dbb6ee49751899cdf38
6
+ metadata.gz: a3a85b5e9b0db2771b549f50662b808cb3a3addd3acd94e0cff379ee5bfa54f24fe2d81b80930f01dc7fc4d441ef0806a37c92538b09167f8e395b27951209e1
7
+ data.tar.gz: df4069209e5532650a3ec58da2149e9490a30c270d8dbcc6edc6aa8546dc6b896578b3b9fdc9eacb0a1588fdcb7b414e3eb2f7cd518245c1f8a4066c534879de
@@ -1,8 +1,13 @@
1
1
  # SortedSet Changelog
2
2
 
3
+ ## 1.0.1 (2020-12-22)
4
+
5
+ * Enhancements
6
+ * Be a no-op library for JRuby, as it has its own version of Set and SortedSet.
7
+
3
8
  ## 1.0.0 (2020-12-22)
4
9
 
5
10
  This is the first release of sorted_set as a gem. Here lists the changes since the version bundled with Ruby 2.7.
6
11
 
7
12
  * Breaking Changes
8
- * The pure-ruby fallback implementation has been removed. It now requires an RBTree library (rbtree for CRuby, rbtree-jruby for JRuby) to install and run.
13
+ * The pure-ruby fallback implementation has been removed. It now requires an RBTree library (rbtree) to install and run.
data/README.md CHANGED
@@ -8,6 +8,9 @@ Every element in SortedSet must be *mutually comparable* to every
8
8
  other: comparison with `<=>` must not return nil for any pair of
9
9
  elements. Otherwise ArgumentError will be raised.
10
10
 
11
+ Currently this library does nothing for JRuby, as it has its own
12
+ version of Set and SortedSet.
13
+
11
14
  ## Installation
12
15
 
13
16
  Add this line to your application's Gemfile:
@@ -1,8 +1,26 @@
1
1
  # :markup: markdown
2
2
 
3
3
  require 'set'
4
+
5
+ return if defined?(JRUBY_VERSION)
6
+
4
7
  require 'rbtree'
5
8
 
9
+ Object.instance_exec do
10
+ # Undefine SortedSet for two reasons.
11
+ #
12
+ # 1. We should wipe out an existing implementation if Ruby 2.x loads
13
+ # this library after loading the standard set library which
14
+ # defines SortedSet.
15
+ #
16
+ # 2. Ruby >=3.0 (set >=1.0.0) sets autoload on SortedSet, and we
17
+ # shouldn't let the following reference to SortedSet fire it
18
+ # because it would end up requiring this library, leading to
19
+ # circular require.
20
+ #
21
+ remove_const :SortedSet if const_defined?(:SortedSet)
22
+ end
23
+
6
24
  ##
7
25
  # SortedSet implements a Set whose elements are sorted in ascending
8
26
  # order (according to the return values of their `<=>` methods) when
@@ -31,27 +49,9 @@ require 'rbtree'
31
49
  # ```
32
50
 
33
51
  class SortedSet < Set
34
- # Remove the existing implementation in case Ruby 2.x loads this
35
- # library after loading the standard set library which defines
36
- # SortedSet.
37
- if class_variable_defined?(:@@setup)
38
- # a hack to shut up warning
39
- alias_method :old_init, :initialize
40
-
41
- instance_methods(false).each { |m| remove_method(m) }
42
- end
43
-
44
52
  # Creates a SortedSet. See Set.new for details.
45
53
  def initialize(*args)
46
54
  @hash = RBTree.new
47
55
  super
48
56
  end
49
-
50
- if class_variable_defined?(:@@setup)
51
- remove_class_variable(:@@setup)
52
- remove_class_variable(:@@mutex) if class_variable_defined?(:@@mutex)
53
-
54
- # a hack to shut up warning
55
- remove_method :old_init
56
- end
57
57
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "sorted_set"
3
- spec.version = "1.0.0"
3
+ spec.version = "1.0.1"
4
4
  spec.authors = ["Akinori MUSHA"]
5
5
  spec.email = ["knu@idaemons.org"]
6
6
 
@@ -22,11 +22,9 @@ Gem::Specification.new do |spec|
22
22
  spec.bindir = "exe"
23
23
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
24
  spec.require_paths = ["lib"]
25
- spec.add_runtime_dependency "set", "~> 1.0"
26
- if defined?(JRUBY_VERSION)
27
- spec.platform = 'java'
28
- spec.add_runtime_dependency "rbtree-jruby"
29
- else
25
+
26
+ unless defined?(JRUBY_VERSION)
27
+ spec.add_runtime_dependency "set", "~> 1.0"
30
28
  spec.add_runtime_dependency "rbtree"
31
29
  end
32
30
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sorted_set
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Akinori MUSHA
@@ -62,7 +62,7 @@ licenses:
62
62
  metadata:
63
63
  homepage_uri: https://github.com/knu/sorted_set
64
64
  source_code_uri: https://github.com/knu/sorted_set
65
- changelog_uri: https://github.com/knu/sorted_set/blob/v1.0.0/CHANGELOG.md
65
+ changelog_uri: https://github.com/knu/sorted_set/blob/v1.0.1/CHANGELOG.md
66
66
  post_install_message:
67
67
  rdoc_options: []
68
68
  require_paths: