rubytree 1.0.2 → 2.0.0

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: e9977428c2a28cf7d3a31ccc91047f646ec88c4f0da90663e9596dfb006ce0c6
4
- data.tar.gz: 0e3a42cf9214d95e5f9deed0511c6728c5204a03a319b30a80d96daf3f20f505
3
+ metadata.gz: 32db11d4bf364a3abad82c8b165293c44ac979a3ba4c5c80e73470558e1cd450
4
+ data.tar.gz: 298a2b4c37fec0b18f48267607f712debe73271e440ad77dc73bbb3ae43b24df
5
5
  SHA512:
6
- metadata.gz: f311eec1cf9a9710cb5905e5c7c691344bd60beb57b472462d40a81e12af475bb6bf328a6502aa8bbb9af17d5d350b163b5d8d36888835866c473b9ea6e13953
7
- data.tar.gz: fdc9890aaf6e298d4400ee6f84398ced73dfdaf93c6fe87a4981dd35c5f17934e2a01e803d44351724c615f11e075fbf3181403cbb4343005452ee47fdfbe25e
6
+ metadata.gz: 9ed55c0a1915ff0d31405d32ec652351b061415c4b696bb044d4e9bf6f0dbaaa406df3d29a7b4236c46bb86467091454e6cccf75e9be5a6ace0651fdbf12610e
7
+ data.tar.gz: 8b215004ac680ca53db74700f1de3c5e08d6c383cbe2b1548281966a4b4a7113c21cd6c4f49b991e4e55fac5da1e0635672c2055bf8ddafa2d8cf50731fbdcc8
data/API-CHANGES.md ADDED
@@ -0,0 +1,153 @@
1
+ # API Changes in RubyTree
2
+
3
+ This lists the various API changes that have been made to the `RubyTree`
4
+ package.
5
+
6
+ _Note_: API changes are expected to reduce significantly after the `1.x`
7
+ release. In most cases, an alternative will be provided to ensure relatively
8
+ smooth transition to the new APIs.
9
+
10
+ ## Release 2.0.0 Changes
11
+
12
+ * The _minimum_ required Ruby version is now `2.6` (or higher).
13
+
14
+ * The long-broken `Tree::TreeNode#depth` method has _finally_ been removed. Use
15
+ [Tree::TreeNode#node_depth][node_depth] instead.
16
+
17
+ * Support for `CamelCase` methods has been removed. This was a legacy shim
18
+ that has hopefully outlived its usefulness.
19
+
20
+ * Use of integers as node-names now no longer requires the optional
21
+ `num_as_name` method argument.
22
+
23
+ * The predicate methods beginning with `is_` or `has_` are now aliases to the
24
+ real methods **without** these prefixes. For example,
25
+ `Tree::TreeNode#is_root?` is now aliased to `Tree::TreeNode#root?`. This is to
26
+ comply with the Ruby standard. These original prefixed method names should be
27
+ considered as deprecated and the corresponding non-prefixed method names
28
+ should be used instead. it is possible that the old prefixed method names
29
+ might be removed in the future.
30
+
31
+ * [structured_warnings][] has been **removed** from the code-base and is no
32
+ longer a dependency. This was a long-standing point of friction for many
33
+ users.
34
+
35
+ ## Release 0.9.5 Changes
36
+
37
+ * The [Tree::TreeNode#add][add] method now provides **move** semantics, if a
38
+ child node on an existing tree is added to another tree, or another location
39
+ on the same tree. In this situation, the child node is removed from its old
40
+ position and added to the new parent node. After the add operation is
41
+ complete, the child no longer exists on the old tree/location.
42
+
43
+ ## Release 0.9.3 Changes
44
+
45
+ * Validation for unique node names has changed in the [Tree::TreeNode#add][add]
46
+ method. `RubyTree` no longer enforces globally unique names. The node-names
47
+ need to be unique _only between_ the sibling nodes.
48
+
49
+ ## Release 0.9.0 Changes
50
+
51
+ * New post-ordered traversal via the
52
+ [Tree::TreeNode#postordered_each][postordered_each] method.
53
+
54
+ * The Binary Tree implementation now supports in-order traversal via the
55
+ [Tree::BinaryTreeNode#inordered_each][inordered_each] method.
56
+
57
+ * `RubyTree` now mixes in the
58
+ [Comparable](http://ruby-doc.org/core-1.8.7/Comparable.html) module.
59
+
60
+ * The traversal methods ([Tree::TreeNode#each][each],
61
+ [Tree::TreeNode#preordered_each][preordered_each],
62
+ [Tree::TreeNode#postordered_each][postordered_each] and
63
+ [Tree::TreeNode#breadth_each][breadth_each] now correctly return an
64
+ [Enumerator](rdoc-ref:http://ruby-doc.org/core-1.8.7/Enumerable.html) as the
65
+ return value when no block is given, and return the receiver node if a block
66
+ was provided. This is consistent with how the standard Ruby collections work.
67
+
68
+ ## Release 0.8.3 Changes
69
+
70
+ * [Tree::TreeNode#siblings][siblings] will now return an empty array for the
71
+ root node.
72
+
73
+ ## Release 0.8.0 Changes
74
+
75
+ * Added the ability to specify an optional insertion position in the
76
+ [Tree::TreeNode#add][add] method. Idea and original code contributed by Dirk.
77
+
78
+ * Added a new method
79
+ [Tree::TreeNode#detached_subtree_copy][detached_subtree_copy] to allow cloning
80
+ the entire tree. This method is also aliased to
81
+ [Tree::TreeNode#dup][dup]. Idea and original code contributed by Vincenzo
82
+ Farruggia.
83
+
84
+ * Converted all _CamelCase_ method names to the canonical ruby_method_names
85
+ (underscore separated). The CamelCase methods can still be invoked, but
86
+ will throw a deprecated warning.
87
+
88
+ ## Release 0.7.0 Changes
89
+
90
+ * Converted all exceptions thrown on invalid method arguments to from
91
+ `RuntimeError` to `ArgumentError`. This impacts the following methods:
92
+
93
+ * [Tree::TreeNode#initialize][initialize]
94
+ * [Tree::TreeNode#add][add]
95
+ * [Tree::TreeNode#[]][access]
96
+ * [Tree::BinaryTreeNode#add][btree_add]
97
+
98
+
99
+ * Added [Tree::TreeNode#level][level] as an alias for
100
+ [Tree::TreeNode#node_depth][node_depth]
101
+
102
+ * Added new methods [Tree::TreeNode#in_degree][in_degree] and
103
+ [Tree::TreeNode#out_degree][out_degree] to report the node's degree stats.
104
+
105
+ * [Tree::TreeNode#is_only_child?][is_only_child] now returns `true` for a root
106
+ node.
107
+
108
+ * [Tree::TreeNode#next_sibling][next_sibling] and
109
+ [Tree::TreeNode#previous_sibling][previous_sibling] now return `nil` for a
110
+ root node.
111
+
112
+ * [Tree::TreeNode#add][add] and [Tree::TreeNode#<<][append] now throw an
113
+ `ArgumentError` exception if a `nil` node is passed as an argument.
114
+
115
+ * Added new methods
116
+ [Tree::TreeNode#to_json][to_json] and
117
+ [Tree::TreeNode#json_create][json_create]
118
+ to convert to/from the JSON format. Thanks to
119
+ [Dirk](http://github.com/railsbros-dirk) for this change.
120
+
121
+ ## Release 0.6.1 Changes
122
+
123
+ * Deprecated the [Tree::Utils::TreeMetricsHandler#depth][depth] method as it was
124
+ returning an incorrect depth value. Have introduced a new replacement method
125
+ [Tree::Utils::TreeMetricsHandler#node_depth][node_depth] which returns the
126
+ correct result.
127
+
128
+
129
+ [structured_warnings]: https://github.com/schmidt/structured_warnings
130
+
131
+ [access]: rdoc-ref:Tree::TreeNode#[]
132
+ [add]: rdoc-ref:Tree::TreeNode#add
133
+ [append]: rdoc-ref:Tree::TreeNode#<<
134
+ [breadth_each]: rdoc-ref:Tree::TreeNode#breadth_each
135
+ [btree_add]: rdoc-ref:Tree::BinaryTreeNode#add
136
+ [depth]: rdoc-ref:Tree::Utils::TreeMetricsHandler#depth
137
+ [detached_subtree_copy]: rdoc-ref:Tree::TreeNode#detached_subtree_copy
138
+ [dup]: rdoc-ref:Tree::TreeNode#dup
139
+ [each]: rdoc-ref:Tree::TreeNode#each
140
+ [in_degree]: rdoc-ref:Tree::Utils::TreeMetricsHandler#in_degree
141
+ [initialize]: rdoc-ref:Tree::TreeNode#initialize
142
+ [inordered_each]: rdoc-ref:Tree::BinaryTreeNode#inordered_each
143
+ [is_only_child]: rdoc-ref:Tree::TreeNode#is_only_child?
144
+ [json_create]: rdoc-ref:Tree::Utils::JSONConverter::ClassMethods#json_create
145
+ [level]: rdoc-ref:Tree::Utils::TreeMetricsHandler#level
146
+ [next_sibling]: rdoc-ref:Tree::TreeNode#next_sibling
147
+ [node_depth]: rdoc-ref:Tree::Utils::TreeMetricsHandler#node_depth
148
+ [out_degree]: rdoc-ref:Tree::Utils::TreeMetricsHandler#out_degree
149
+ [postordered_each]: rdoc-ref:Tree::TreeNode#postordered_each
150
+ [preordered_each]: rdoc-ref:Tree::TreeNode#preordered_each
151
+ [previous_sibling]: rdoc-ref:Tree::TreeNode#previous_sibling
152
+ [siblings]: rdoc-ref:Tree::TreeNode#siblings
153
+ [to_json]: rdoc-ref:Tree::Utils::JSONConverter#to_json
data/Gemfile CHANGED
@@ -1,8 +1,4 @@
1
- source 'https://rubygems.org'
1
+ # frozen_string_literal: true
2
2
 
3
- # Specify your gem's dependencies in rubytree.gemspec
3
+ source 'https://rubygems.org'
4
4
  gemspec
5
-
6
- # Local Variables:
7
- # mode: ruby
8
- # End:
data/Gemfile.lock CHANGED
@@ -1,97 +1,82 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rubytree (1.0.2)
5
- json (~> 2.6.1)
6
- structured_warnings (~> 0.4.0)
4
+ rubytree (2.0.0)
5
+ json (~> 2.0, > 2.3.1)
7
6
 
8
7
  GEM
9
8
  remote: https://rubygems.org/
10
9
  specs:
11
10
  ast (2.4.2)
12
- coveralls (0.8.23)
13
- json (>= 1.8, < 3)
14
- simplecov (~> 0.16.1)
15
- term-ansicolor (~> 1.3)
16
- thor (>= 0.19.4, < 2.0)
17
- tins (~> 1.6)
18
11
  diff-lcs (1.5.0)
19
- docile (1.4.0)
20
- json (2.6.1)
21
- parallel (1.21.0)
22
- parser (3.0.3.2)
12
+ json (2.6.2)
13
+ parallel (1.22.1)
14
+ parser (3.1.2.0)
23
15
  ast (~> 2.4.1)
24
16
  power_assert (2.0.1)
25
- psych (4.0.3)
17
+ psych (4.0.4)
26
18
  stringio
27
- rainbow (3.0.0)
19
+ rainbow (3.1.1)
28
20
  rake (13.0.6)
29
21
  rdoc (6.4.0)
30
22
  psych (>= 4.0.0)
31
- regexp_parser (2.2.0)
23
+ regexp_parser (2.5.0)
32
24
  rexml (3.2.5)
33
- rspec (3.10.0)
34
- rspec-core (~> 3.10.0)
35
- rspec-expectations (~> 3.10.0)
36
- rspec-mocks (~> 3.10.0)
37
- rspec-core (3.10.1)
38
- rspec-support (~> 3.10.0)
39
- rspec-expectations (3.10.1)
25
+ rspec (3.11.0)
26
+ rspec-core (~> 3.11.0)
27
+ rspec-expectations (~> 3.11.0)
28
+ rspec-mocks (~> 3.11.0)
29
+ rspec-core (3.11.0)
30
+ rspec-support (~> 3.11.0)
31
+ rspec-expectations (3.11.0)
40
32
  diff-lcs (>= 1.2.0, < 2.0)
41
- rspec-support (~> 3.10.0)
42
- rspec-mocks (3.10.2)
33
+ rspec-support (~> 3.11.0)
34
+ rspec-mocks (3.11.1)
43
35
  diff-lcs (>= 1.2.0, < 2.0)
44
- rspec-support (~> 3.10.0)
45
- rspec-support (3.10.3)
36
+ rspec-support (~> 3.11.0)
37
+ rspec-support (3.11.0)
46
38
  rtags (0.97)
47
39
  rtagstask (0.0.4)
48
40
  rtags (> 0.0.0)
49
- rubocop (1.24.0)
41
+ rubocop (1.30.1)
50
42
  parallel (~> 1.10)
51
- parser (>= 3.0.0.0)
43
+ parser (>= 3.1.0.0)
52
44
  rainbow (>= 2.2.2, < 4.0)
53
45
  regexp_parser (>= 1.8, < 3.0)
54
- rexml
55
- rubocop-ast (>= 1.15.0, < 2.0)
46
+ rexml (>= 3.2.5, < 4.0)
47
+ rubocop-ast (>= 1.18.0, < 2.0)
56
48
  ruby-progressbar (~> 1.7)
57
49
  unicode-display_width (>= 1.4.0, < 3.0)
58
- rubocop-ast (1.15.1)
59
- parser (>= 3.0.1.1)
50
+ rubocop-ast (1.18.0)
51
+ parser (>= 3.1.1.0)
52
+ rubocop-rake (0.6.0)
53
+ rubocop (~> 1.0)
54
+ rubocop-rspec (2.11.1)
55
+ rubocop (~> 1.19)
60
56
  ruby-progressbar (1.11.0)
61
- simplecov (0.16.1)
62
- docile (~> 1.1)
63
- json (>= 1.8, < 3)
64
- simplecov-html (~> 0.10.0)
65
- simplecov-html (0.10.2)
66
- stringio (3.0.1)
67
- structured_warnings (0.4.0)
68
- sync (0.5.0)
69
- term-ansicolor (1.7.1)
70
- tins (~> 1.0)
57
+ stringio (3.0.2)
71
58
  test-unit (3.5.3)
72
59
  power_assert
73
- thor (1.1.0)
74
- tins (1.30.0)
75
- sync
76
60
  unicode-display_width (2.1.0)
77
61
  webrick (1.7.0)
78
- yard (0.9.27)
62
+ yard (0.9.28)
79
63
  webrick (~> 1.7.0)
80
64
 
81
65
  PLATFORMS
82
66
  ruby
83
67
 
84
68
  DEPENDENCIES
85
- bundler (~> 2.3.4)
86
- coveralls (>= 0.8.23)
87
- rake (>= 13.0.6)
88
- rdoc (>= 6.4.0)
89
- rspec (~> 3.10.0)
69
+ bundler (~> 2.3)
70
+ rake (~> 13.0)
71
+ rdoc (~> 6.0)
72
+ rspec (~> 3.0, > 3.10)
90
73
  rtagstask (~> 0.0.4)
91
- rubocop (>= 1.24.0)
74
+ rubocop (~> 1.0)
75
+ rubocop-rake (~> 0.0)
76
+ rubocop-rspec (~> 2.0)
92
77
  rubytree!
93
- test-unit (>= 3.5.3)
94
- yard (~> 0.9.27)
78
+ test-unit (~> 3.0)
79
+ yard (~> 0.0, >= 0.9.20)
95
80
 
96
81
  BUNDLED WITH
97
82
  2.3.4