rubytree 0.9.7 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/API-CHANGES.md +153 -0
- data/Gemfile +2 -13
- data/Gemfile.lock +60 -61
- data/History.md +410 -0
- data/LICENSE.md +1 -2
- data/README.md +24 -28
- data/Rakefile +65 -48
- data/TODO.org +19 -15
- data/examples/example_basic.rb +19 -12
- data/lib/rubytree.rb +3 -4
- data/lib/tree/binarytree.rb +27 -27
- data/lib/tree/tree_deps.rb +9 -12
- data/lib/tree/utils/hash_converter.rb +127 -121
- data/lib/tree/utils/json_converter.rb +81 -79
- data/lib/tree/utils/metrics_methods.rb +18 -48
- data/lib/tree/utils/path_methods.rb +15 -17
- data/lib/tree/utils/tree_merge_handler.rb +79 -80
- data/lib/tree/utils/utils.rb +9 -6
- data/lib/tree/version.rb +3 -5
- data/lib/tree.rb +194 -177
- data/rubytree.gemspec +67 -44
- data/spec/spec_helper.rb +5 -3
- data/spec/tree_spec.rb +136 -37
- data/test/run_test.rb +9 -8
- data/test/test_binarytree.rb +86 -105
- data/test/test_rubytree_require.rb +4 -5
- data/test/test_subclassed_node.rb +5 -26
- data/test/test_thread_and_fiber.rb +13 -16
- data/test/test_tree.rb +577 -657
- metadata +142 -55
- data/API-CHANGES.rdoc +0 -99
- data/History.rdoc +0 -303
- data/TAGS +0 -248
- data/gem_graph.png +0 -0
- data/lib/tree/utils/camel_case_method_handler.rb +0 -79
- data/setup.rb +0 -1585
data/History.rdoc
DELETED
@@ -1,303 +0,0 @@
|
|
1
|
-
= History of Changes
|
2
|
-
|
3
|
-
=== 0.9.7 / 2015-12-31
|
4
|
-
|
5
|
-
* Released 0.9.6. This is a minor bug-fix release.
|
6
|
-
|
7
|
-
* This release allows the {Tree::TreeNode#print_tree} method to be used on
|
8
|
-
non-root nodes. Thanks to {https://github.com/ojab Ojab}.
|
9
|
-
|
10
|
-
* The spaceship operator ('<=>') now returns 'nil' if the object being compared
|
11
|
-
to is itself 'nil' or not another {Tree::TreeNode}.
|
12
|
-
|
13
|
-
=== 0.9.6 / 2015-05-30
|
14
|
-
|
15
|
-
* Released 0.9.6, which is same as 0.9.5, except for an update to the Gem release date.
|
16
|
-
|
17
|
-
=== 0.9.5 / 2015-05-30
|
18
|
-
|
19
|
-
* Released 0.9.5.
|
20
|
-
|
21
|
-
=== 0.9.5pre7 / 2015-05-30
|
22
|
-
|
23
|
-
* Added new methods for getting the path of a node as a string. These have been
|
24
|
-
added as a new mixin {Tree::Utils::TreePathHandler}. Thanks to
|
25
|
-
{https://github.com/MZic Marco Ziccardi}.
|
26
|
-
|
27
|
-
=== 0.9.5pre5 / 2015-01-01
|
28
|
-
|
29
|
-
* Fixed {issue 32}[https://github.com/evolve75/RubyTree/issues/32] and enabled
|
30
|
-
'move' semantics on the {Tree::TreeNode#add} method, so that a child being
|
31
|
-
added, that has an existing parent, will be removed from its old parent, prior
|
32
|
-
to being added to the new location.
|
33
|
-
|
34
|
-
=== 0.9.5pre4 / 2014-12-17
|
35
|
-
|
36
|
-
* Added performance improvements to {Tree::TreeNode#is_root?} and
|
37
|
-
{Tree::Utils::TreeMetricsHandler#node_depth}.
|
38
|
-
Thanks to {https://github.com/aidansteele Aidan Steel}.
|
39
|
-
|
40
|
-
=== 0.9.5pre3 / 2014-12-16
|
41
|
-
|
42
|
-
* Minor fix to correct the release date. This release is otherwise identical to
|
43
|
-
0.9.5pre2.
|
44
|
-
|
45
|
-
=== 0.9.5pre2 / 2014-12-16
|
46
|
-
|
47
|
-
* Added {Tree::TreeNode#rename} and {Tree::TreeNode#rename_child} methods by
|
48
|
-
merging in code from {https://github.com/evolve75/RubyTree/pull/35}. Thanks to
|
49
|
-
{http://github.com/packetmonkey Evan Sharp}.
|
50
|
-
|
51
|
-
=== 0.9.5pre / 2014-11-01
|
52
|
-
|
53
|
-
* Fixed {issue 13}[https://github.com/evolve75/RubyTree/issues/13] with the
|
54
|
-
patch provided by {Jen Hamon}[http://www.github.com/jhamon].
|
55
|
-
|
56
|
-
* Fixed a bug in {Tree::TreeNode#print_tree} with the patch provided by
|
57
|
-
{https://github.com/packetmonkey Evan Sharp}.
|
58
|
-
|
59
|
-
* Fixed {issue 31}[https://github.com/evolve75/RubyTree/issues/31], which was
|
60
|
-
causing incorrect behavior n {Tree::TreeNode#postordered_each} and
|
61
|
-
{Tree::TreeNode#breadth_each} methods when a block was not provided.
|
62
|
-
|
63
|
-
=== 0.9.4 / 2014-07-04
|
64
|
-
|
65
|
-
* Changed all references to {http://rubyforge.org}.
|
66
|
-
|
67
|
-
=== 0.9.3 / 2014-02-01
|
68
|
-
|
69
|
-
* Fixed the issue with globally unique node names. See Github issue #24.
|
70
|
-
|
71
|
-
=== 0.9.2 / 2014-01-03
|
72
|
-
|
73
|
-
* Yanked R0.9.1 as the History file was not updated.
|
74
|
-
|
75
|
-
* Updated the gem description.
|
76
|
-
|
77
|
-
* Changed the travis-ci build to include coverall support.
|
78
|
-
|
79
|
-
=== 0.9.1 / 2014-01-03
|
80
|
-
|
81
|
-
* Updated the Gem description.
|
82
|
-
|
83
|
-
* Incorporated code coverage using the coverall gem.
|
84
|
-
|
85
|
-
=== 0.9.0 / 2014-01-02
|
86
|
-
|
87
|
-
This is a feature and bug-fix release.
|
88
|
-
|
89
|
-
==== The Features
|
90
|
-
|
91
|
-
* Rubytree now supports +postordered+ traversal via the
|
92
|
-
{Tree::TreeNode#postordered_each} method. Thanks to
|
93
|
-
{https://github.com/pdecourcel Paul de Courcel} for this.
|
94
|
-
|
95
|
-
* The Binary tree now supports +inorder+ traversal via the
|
96
|
-
{Tree::BinaryTreeNode#inordered_each} method.
|
97
|
-
|
98
|
-
* Ability to merge in another tree at a chosen node, or merge two trees to
|
99
|
-
create a third tree. Thanks to {https://github.com/dazoakley Darren Oakley}
|
100
|
-
for this ({https://github.com/evolve75/RubyTree/pull/2 pull request #2})
|
101
|
-
|
102
|
-
* RubyTree now mixes in the {http://ruby-doc.org/core-1.8.7/Comparable.html
|
103
|
-
Comparable} module.
|
104
|
-
|
105
|
-
==== The Fixes
|
106
|
-
|
107
|
-
* (Partial) fix for preventing cyclic graphs in the tree
|
108
|
-
|
109
|
-
* Refactored the {Tree::TreeNode#each} method to prevent stack errors while
|
110
|
-
navigating deep trees
|
111
|
-
({https://github.com/evolve75/RubyTree/issues/12 issue #12})
|
112
|
-
|
113
|
-
* Check to ensure that the added node's name is unique to the destination tree
|
114
|
-
({https://github.com/evolve75/RubyTree/pull/9 merge #9}). Thanks to
|
115
|
-
{https://github.com/ysf Youssef Rebahi-Gilbert} for the idea and the initial
|
116
|
-
code
|
117
|
-
|
118
|
-
* Fix for {issue 23}[https://github.com/evolve75/RubyTree/issues/23], where the
|
119
|
-
tree traversal on a binary tree would fail if the _left_ child was +nil+
|
120
|
-
|
121
|
-
* The traversal methods ({Tree::TreeNode#each},
|
122
|
-
{Tree::TreeNode#preordered_each}, {Tree::TreeNode#postordered_each} and
|
123
|
-
{Tree::TreeNode#breadth_each}) now correctly return an
|
124
|
-
{http://ruby-doc.org/core-1.8.7/Enumerable.html Enumerator} as the
|
125
|
-
return value when no block is given, and return the receiver node if a block was
|
126
|
-
provided. This is consistent with how the standard Ruby collections work.
|
127
|
-
|
128
|
-
==== Other Changes
|
129
|
-
|
130
|
-
* Structural changes in the code to refactor out the non-core functions into
|
131
|
-
modules (mostly by extracting out non-core code as mixins).
|
132
|
-
|
133
|
-
* Significant refactoring of the documentation. The {http://yardoc.org Yardoc}
|
134
|
-
tags are now extensively used.
|
135
|
-
|
136
|
-
* Basic support built-in for including example code in the Gem. This will be
|
137
|
-
fully expanded in the next release.
|
138
|
-
|
139
|
-
* Various changes to the {http://bundler.io bundler}, {https://travis-ci.org
|
140
|
-
travis-ci} and other Rakefile related changes.
|
141
|
-
|
142
|
-
=== 0.8.3 / 2012-08-21
|
143
|
-
|
144
|
-
This is a primarily a bug-fix release, with some packaging changes.
|
145
|
-
|
146
|
-
* Have removed the dependency on Hoe[https://github.com/seattlerb/hoe]. The
|
147
|
-
build is now vanilla
|
148
|
-
{gemspec}[http://guides.rubygems.org/specification-reference/] based.
|
149
|
-
|
150
|
-
* Included support for {gem-testers}[http://test.rubygems.org/].
|
151
|
-
|
152
|
-
* Included support for {Bundler}[http://gembundler.com/].
|
153
|
-
|
154
|
-
* Implemented the {Tree::Utils::JSONConverter#as_json} method to support Rails'
|
155
|
-
JSON encoding, by pulling in the changes by Eric Cline
|
156
|
-
(https://github.com/escline).
|
157
|
-
|
158
|
-
* Partial fix for {Github Bug
|
159
|
-
#5}[https://github.com/evolve75/RubyTree/issues/5]. This is to
|
160
|
-
prevent infinite looping is an existing node is added again
|
161
|
-
elsewhere in the tree.
|
162
|
-
|
163
|
-
* Fixed the issue with using +integers+ as node names, and its
|
164
|
-
interaction with the +Tree::TreeNode#[]+ access method as documented in
|
165
|
-
{Github Bug #6}[https://github.com/evolve75/RubyTree/issues/6].
|
166
|
-
|
167
|
-
* Clarified the need to have unique node names {Github Bug
|
168
|
-
#7}[https://github.com/evolve75/RubyTree/issues/7] (documentation).
|
169
|
-
|
170
|
-
* Fixed {Tree::TreeNode#siblings} method to return an empty array for the
|
171
|
-
root node as well (it returned +nil+ earlier).
|
172
|
-
|
173
|
-
=== 0.8.2 / 2011-12-15
|
174
|
-
|
175
|
-
* Minor bug-fix release to address bug #1215 ({Tree::TreeNode#to_s}
|
176
|
-
breaks if +@content+ or +@parent.name+ is not a string).
|
177
|
-
|
178
|
-
=== 0.8.1 / 2010-10-02
|
179
|
-
|
180
|
-
* This is the public release of +R0.8.0+, with additional bug-fixes.
|
181
|
-
Note that +R0.8.0+ will not be released separately as a publicly
|
182
|
-
available Rubygem. All changes as listed for +R0.8.0+ are available in
|
183
|
-
this release.
|
184
|
-
|
185
|
-
* The main change in +R0.8.0+/+R0.8.1+ is conversion of all CamelCase
|
186
|
-
method names to snake_case. The old CamelCase method names will
|
187
|
-
still work (to ensure backwards compatibility), but will also
|
188
|
-
display a warning.
|
189
|
-
|
190
|
-
* The {Tree::TreeNode#add} method now accepts an optional child insertion
|
191
|
-
point.
|
192
|
-
|
193
|
-
* The subtree from the current node can now be cloned in its entirety
|
194
|
-
using the {Tree::TreeNode#detached_subtree_copy} method.
|
195
|
-
|
196
|
-
* A major bug-fix for {bug #28613}[http://rubyforge.org/tracker/index.php?func=detail&aid=28613&group_id=1215&atid=4793]
|
197
|
-
which impacted the Binarytree implementation.
|
198
|
-
|
199
|
-
* Minor code re-factoring driven by the code-smell checks using
|
200
|
-
{reek}[https://github.com/troessner/reek].
|
201
|
-
|
202
|
-
* Inclusion of the +reek+ code-smell detection tool in the Rakefile.
|
203
|
-
|
204
|
-
=== 0.8.0 / 2010-05-04
|
205
|
-
|
206
|
-
* Updated the {Tree::TreeNode#add} method to allow the optional specification
|
207
|
-
of an insertion position in the child array.
|
208
|
-
|
209
|
-
* Added a new method {Tree::TreeNode#detached_subtree_copy} to allow cloning
|
210
|
-
the entire tree (this method is also aliased as +dup+).
|
211
|
-
|
212
|
-
* Converted all +CamelCase+ method names to the canonical +ruby_method_names+
|
213
|
-
(underscore separated). The +CamelCase+ methods _can still_ be invoked, but will
|
214
|
-
throw a {http://rug-b.rubyforge.org/structured_warnings/rdoc/ Deprecated
|
215
|
-
warning}.
|
216
|
-
The support for old CamelCase methods will go away some time in the future,
|
217
|
-
so the user is advised to convert all current method invocations
|
218
|
-
to the new names.
|
219
|
-
|
220
|
-
=== 0.7.0 / 2010-05-03
|
221
|
-
|
222
|
-
* Added new methods to report the degree statistics of a node.
|
223
|
-
|
224
|
-
* Added a convenience method alias
|
225
|
-
{Tree::Utils::TreeMetricsHandler#level Tree::TreeNode#level} to +nodeDepth+.
|
226
|
-
|
227
|
-
* Converted the exceptions thrown on invalid arguments to
|
228
|
-
{http://www.ruby-doc.org/core-2.0.0/ArgumentError.html ArgumentError}
|
229
|
-
instead of {http://www.ruby-doc.org/core-2.0.0/RuntimeError.html RuntimeError}.
|
230
|
-
|
231
|
-
* Converted the documentation to {http://yardoc.org Yard} format.
|
232
|
-
|
233
|
-
* Added new methods for converting from/to {http://www.json.org JSON} formats.
|
234
|
-
Thanks to Dirk Breuer[http://github.com/railsbros-dirk] for this
|
235
|
-
fork[http://github.com/galaxycats/].
|
236
|
-
|
237
|
-
* Added a separate {file:API-CHANGES.rdoc} documentation file.
|
238
|
-
|
239
|
-
* Added fixes for root related edge conditions to {Tree::TreeNode#is_only_child?
|
240
|
-
isOnlyChild?}, {Tree::TreeNode#next_sibling nextSibling},
|
241
|
-
{Tree::TreeNode#previous_sibling previousSibling} and
|
242
|
-
{Tree::TreeNode#remove! remove!} methods.
|
243
|
-
|
244
|
-
* Removed the 'ChangeLog' file as this can now be generated from the git logs.
|
245
|
-
|
246
|
-
* Other minor code cleanup.
|
247
|
-
|
248
|
-
=== 0.6.2 / 2010-01-30
|
249
|
-
|
250
|
-
* Updated the documentation.
|
251
|
-
|
252
|
-
=== 0.6.1 / 2010-01-04
|
253
|
-
|
254
|
-
* Changed the hard-dependency on the 'structured_warnings' RubyGem to a
|
255
|
-
soft-dependency - which lets Rubytree still work if this RubyGem is not
|
256
|
-
available. The rationale for this is that we should not require the user to
|
257
|
-
install a separate library just for one single edge-case function (in this
|
258
|
-
case, to indicate a deprecated method). However, if the library _is_ available
|
259
|
-
on the user's system, then it will get used.
|
260
|
-
|
261
|
-
=== 0.6.0 / 2010-01-03
|
262
|
-
|
263
|
-
* Fixed the
|
264
|
-
bug#22535[http://rubyforge.org/tracker/index.php?func=detail&aid=22535&group_id=1215&atid=4793]
|
265
|
-
where the {Tree::Utils::TreeMetricsHandler#depth Tree::TreeNode#depth} method
|
266
|
-
was actually returning height+1 (not the depth).
|
267
|
-
|
268
|
-
* Marked the {Tree::Utils::TreeMetricsHandler#depth Tree::TreeNode#depth}
|
269
|
-
method as *deprecated* (and introduced the run-time dependency on
|
270
|
-
structured-warnings[http://github.com/schmidt/structured_warnings] gem).
|
271
|
-
|
272
|
-
=== 0.5.3 / 2009-12-31
|
273
|
-
|
274
|
-
* Cleanup of the build system to exclusively use Hoe.
|
275
|
-
* Modifications and reformatting to the documentation.
|
276
|
-
* No user visible changes.
|
277
|
-
|
278
|
-
=== 0.5.2 / 2007-12-21
|
279
|
-
|
280
|
-
* Added more test cases and enabled
|
281
|
-
{https://github.com/seattlerb/zentest ZenTest} compatibility for the test case
|
282
|
-
names.
|
283
|
-
|
284
|
-
=== 0.5.1 / 2007-12-20
|
285
|
-
|
286
|
-
* Minor code refactoring.
|
287
|
-
|
288
|
-
=== 0.5.0 / 2007-12-18
|
289
|
-
|
290
|
-
* Fixed the marshalling code to correctly handle non-string content.
|
291
|
-
|
292
|
-
=== 0.4.3 / 2007-10-09
|
293
|
-
|
294
|
-
* Changes to the build mechanism (now uses
|
295
|
-
{http://www.zenspider.com/projects/hoe.html Hoe}).
|
296
|
-
|
297
|
-
=== 0.4.2 / 2007-10-01
|
298
|
-
|
299
|
-
* Minor code refactoring. Changes in the Rakefile.
|
300
|
-
|
301
|
-
;; Local Variables:
|
302
|
-
;; mode: rdoc
|
303
|
-
;; End:
|
data/TAGS
DELETED
@@ -1,248 +0,0 @@
|
|
1
|
-
|
2
|
-
lib/rubytree.rb,0
|
3
|
-
|
4
|
-
lib/tree/binarytree.rb,795
|
5
|
-
module Tree::Tree43,1906
|
6
|
-
class BinaryTreeNode::Tree::BinaryTreeNode52,2215
|
7
|
-
def left_child::Tree::BinaryTreeNode#left_child62,2498
|
8
|
-
def right_child::Tree::BinaryTreeNode#right_child74,2889
|
9
|
-
def is_left_child?::Tree::BinaryTreeNode#is_left_child?83,3165
|
10
|
-
def is_right_child?::Tree::BinaryTreeNode#is_right_child?93,3496
|
11
|
-
def add::Tree::BinaryTreeNode#add110,4153
|
12
|
-
def add_from_hash::Tree::BinaryTreeNode#add_from_hash143,5539
|
13
|
-
def inordered_each::Tree::BinaryTreeNode#inordered_each160,6096
|
14
|
-
def set_child_at::Tree::BinaryTreeNode#set_child_at191,7032
|
15
|
-
def left_child=::Tree::BinaryTreeNode#left_child=210,7700
|
16
|
-
def right_child=::Tree::BinaryTreeNode#right_child=222,8069
|
17
|
-
def swap_children::Tree::BinaryTreeNode#swap_children227,8215
|
18
|
-
|
19
|
-
lib/tree/tree_deps.rb,0
|
20
|
-
|
21
|
-
lib/tree/utils/camel_case_method_handler.rb,324
|
22
|
-
module Tree::Tree41,1848
|
23
|
-
module CamelCaseMethodHandler::Tree::CamelCaseMethodHandler44,2004
|
24
|
-
def self.included::Tree::CamelCaseMethodHandler.included45,2038
|
25
|
-
def method_missing::Tree::CamelCaseMethodHandler#method_missing49,2186
|
26
|
-
def to_snake_case::Tree::CamelCaseMethodHandler#to_snake_case66,2798
|
27
|
-
|
28
|
-
lib/tree/utils/hash_converter.rb,265
|
29
|
-
module Tree::Tree40,1916
|
30
|
-
def self.included::Tree.included42,1953
|
31
|
-
module ClassMethods::Tree::ClassMethods49,2177
|
32
|
-
def from_hash::Tree::ClassMethods#from_hash86,3823
|
33
|
-
def add_from_hash::Tree#add_from_hash129,5519
|
34
|
-
def to_h::Tree#to_h151,6367
|
35
|
-
|
36
|
-
lib/tree/utils/json_converter.rb,258
|
37
|
-
module Tree::Tree42,1925
|
38
|
-
def self.included::Tree.included44,1962
|
39
|
-
def as_json::Tree#as_json61,2413
|
40
|
-
def to_json::Tree#to_json89,3121
|
41
|
-
module ClassMethods::Tree::ClassMethods94,3271
|
42
|
-
def json_create::Tree::ClassMethods#json_create113,3986
|
43
|
-
|
44
|
-
lib/tree/utils/metrics_methods.rb,718
|
45
|
-
module Tree::Tree41,1833
|
46
|
-
module TreeMetricsHandler::Tree::TreeMetricsHandler43,1918
|
47
|
-
def self.included::Tree::TreeMetricsHandler.included44,1948
|
48
|
-
def size::Tree::TreeMetricsHandler#size56,2317
|
49
|
-
def length::Tree::TreeMetricsHandler#length67,2661
|
50
|
-
def node_height::Tree::TreeMetricsHandler#node_height80,3078
|
51
|
-
def node_depth::Tree::TreeMetricsHandler#node_depth96,3689
|
52
|
-
def level::Tree::TreeMetricsHandler#level105,3875
|
53
|
-
def depth::Tree::TreeMetricsHandler#depth124,4560
|
54
|
-
def breadth::Tree::TreeMetricsHandler#breadth140,5197
|
55
|
-
def in_degree::Tree::TreeMetricsHandler#in_degree154,5660
|
56
|
-
def out_degree::Tree::TreeMetricsHandler#out_degree165,5973
|
57
|
-
|
58
|
-
lib/tree/utils/tree_merge_handler.rb,214
|
59
|
-
module Tree::Tree40,1769
|
60
|
-
def merge::Tree#merge57,2500
|
61
|
-
def merge!::Tree#merge!72,3134
|
62
|
-
def check_merge_prerequisites::Tree#check_merge_prerequisites85,3441
|
63
|
-
def merge_trees::Tree#merge_trees102,4086
|
64
|
-
|
65
|
-
lib/tree/utils/utils.rb,27
|
66
|
-
module Tree::Tree39,1838
|
67
|
-
|
68
|
-
lib/tree/version.rb,27
|
69
|
-
module Tree::Tree38,1723
|
70
|
-
|
71
|
-
lib/tree.rb,2947
|
72
|
-
module Tree::Tree48,2158
|
73
|
-
class TreeNode::Tree::TreeNode85,3731
|
74
|
-
attr_reader :name::Tree::TreeNode#name113,4634
|
75
|
-
attr_accessor :content::Tree::TreeNode#content120,4833
|
76
|
-
attr_reader :parent::Tree::TreeNode#parent124,4949
|
77
|
-
def root::Tree::TreeNode#root131,5161
|
78
|
-
def is_root?::Tree::TreeNode#is_root?142,5467
|
79
|
-
def has_content?::Tree::TreeNode#has_content?150,5650
|
80
|
-
def is_leaf?::Tree::TreeNode#is_leaf?161,5904
|
81
|
-
def parentage::Tree::TreeNode#parentage173,6279
|
82
|
-
def has_children?::Tree::TreeNode#has_children?191,6705
|
83
|
-
def initialize::Tree::TreeNode#Tree::TreeNode.new214,7531
|
84
|
-
def detached_copy::Tree::TreeNode#detached_copy232,8148
|
85
|
-
def detached_subtree_copy::Tree::TreeNode#detached_subtree_copy242,8434
|
86
|
-
alias :dup::Tree::TreeNode#dup251,8695
|
87
|
-
def marshal_dump::Tree::TreeNode#marshal_dump256,8873
|
88
|
-
def create_dump_rep::Tree::TreeNode#create_dump_rep262,9041
|
89
|
-
def marshal_load::Tree::TreeNode#marshal_load277,9579
|
90
|
-
def to_s::Tree::TreeNode#to_s302,10363
|
91
|
-
def <<::Tree::TreeNode#<<325,11134
|
92
|
-
def add::Tree::TreeNode#add360,12662
|
93
|
-
def insertion_range::Tree::TreeNode#insertion_range380,13624
|
94
|
-
def rename::Tree::TreeNode#rename394,13993
|
95
|
-
def rename_child::Tree::TreeNode#rename_child413,14502
|
96
|
-
def name=::Tree::TreeNode#name=426,14986
|
97
|
-
def replace!::Tree::TreeNode#replace!436,15333
|
98
|
-
def replace_with::Tree::TreeNode#replace_with450,15706
|
99
|
-
def remove!::Tree::TreeNode#remove!468,16438
|
100
|
-
def parent=::Tree::TreeNode#parent=483,16841
|
101
|
-
def remove_from_parent!::Tree::TreeNode#remove_from_parent!496,17234
|
102
|
-
def remove_all!::Tree::TreeNode#remove_all!507,17606
|
103
|
-
def set_as_root!::Tree::TreeNode#set_as_root!518,17835
|
104
|
-
def freeze_tree!::Tree::TreeNode#freeze_tree!528,18161
|
105
|
-
def []::Tree::TreeNode#[]568,19679
|
106
|
-
def each::Tree::TreeNode#each593,20646
|
107
|
-
def preordered_each::Tree::TreeNode#preordered_each621,21606
|
108
|
-
def postordered_each::Tree::TreeNode#postordered_each633,22018
|
109
|
-
def breadth_each::Tree::TreeNode#breadth_each669,23463
|
110
|
-
def children::Tree::TreeNode#children695,24416
|
111
|
-
def each_leaf::Tree::TreeNode#each_leaf716,25037
|
112
|
-
def first_child::Tree::TreeNode#first_child733,25459
|
113
|
-
def last_child::Tree::TreeNode#last_child741,25670
|
114
|
-
def first_sibling::Tree::TreeNode#first_sibling757,26117
|
115
|
-
def is_first_sibling?::Tree::TreeNode#is_first_sibling?767,26391
|
116
|
-
def last_sibling::Tree::TreeNode#last_sibling781,26807
|
117
|
-
def is_last_sibling?::Tree::TreeNode#is_last_sibling?791,27077
|
118
|
-
def siblings::Tree::TreeNode#siblings807,27630
|
119
|
-
def is_only_child?::Tree::TreeNode#is_only_child?826,28182
|
120
|
-
def next_sibling::Tree::TreeNode#next_sibling839,28585
|
121
|
-
def previous_sibling::Tree::TreeNode#previous_sibling855,29059
|
122
|
-
def <=>::Tree::TreeNode#<=>871,29570
|
123
|
-
def print_tree::Tree::TreeNode#print_tree881,29950
|
124
|
-
|
125
|
-
test/run_test.rb,0
|
126
|
-
|
127
|
-
test/test_binarytree.rb,1361
|
128
|
-
module TestTree::TestTree39,1717
|
129
|
-
class TestBinaryTreeNode::TestTree::TestBinaryTreeNode41,1776
|
130
|
-
def setup::TestTree::TestBinaryTreeNode#setup44,1868
|
131
|
-
def teardown::TestTree::TestBinaryTreeNode#teardown52,2171
|
132
|
-
def test_initialize::TestTree::TestBinaryTreeNode#test_initialize59,2330
|
133
|
-
def test_from_hash::TestTree::TestBinaryTreeNode#test_from_hash66,2692
|
134
|
-
def test_add_from_hash::TestTree::TestBinaryTreeNode#test_add_from_hash101,4024
|
135
|
-
def test_add::TestTree::TestBinaryTreeNode#test_add134,5134
|
136
|
-
def test_inordered_each::TestTree::TestBinaryTreeNode#test_inordered_each157,6048
|
137
|
-
def test_left_child::TestTree::TestBinaryTreeNode#test_left_child201,7516
|
138
|
-
def test_right_child::TestTree::TestBinaryTreeNode#test_right_child209,7829
|
139
|
-
def test_left_child_equals::TestTree::TestBinaryTreeNode#test_left_child_equals217,8142
|
140
|
-
def test_right_child_equals::TestTree::TestBinaryTreeNode#test_right_child_equals236,9132
|
141
|
-
def test_is_left_child_eh::TestTree::TestBinaryTreeNode#test_is_left_child_eh256,10249
|
142
|
-
def test_is_right_child_eh::TestTree::TestBinaryTreeNode#test_is_right_child_eh271,10788
|
143
|
-
def test_swap_children::TestTree::TestBinaryTreeNode#test_swap_children285,11334
|
144
|
-
def test_old_camelCase_method_names::TestTree::TestBinaryTreeNode#test_old_camelCase_method_names303,12217
|
145
|
-
|
146
|
-
test/test_rubytree_require.rb,203
|
147
|
-
module TestTree::TestTree38,1678
|
148
|
-
class TestRequireRubytree::TestTree::TestRequireRubytree41,1759
|
149
|
-
def test_create_a_simple_node::TestTree::TestRequireRubytree#test_create_a_simple_node44,1884
|
150
|
-
|
151
|
-
test/test_subclassed_node.rb,389
|
152
|
-
module TestTree::TestTree39,1688
|
153
|
-
class TestSubclassedTreeNode::TestTree::TestSubclassedTreeNode42,1741
|
154
|
-
class MyNode::TestTree::TestSubclassedTreeNode::MyNode45,1868
|
155
|
-
def my_dummy_method::TestTree::TestSubclassedTreeNode::MyNode#my_dummy_method47,1967
|
156
|
-
def test_subclassed_camelcase_methods::TestTree::TestSubclassedTreeNode#test_subclassed_camelcase_methods52,2026
|
157
|
-
|
158
|
-
test/test_thread_and_fiber.rb,422
|
159
|
-
module TestTree::TestTree39,1695
|
160
|
-
class TestFiberAndThreadOnNode::TestTree::TestFiberAndThreadOnNode41,1747
|
161
|
-
def create_long_depth_trees::TestTree::TestFiberAndThreadOnNode#create_long_depth_trees44,1843
|
162
|
-
def test_fiber_for_recursion::TestTree::TestFiberAndThreadOnNode#test_fiber_for_recursion59,2260
|
163
|
-
def test_thread_for_recursion::TestTree::TestFiberAndThreadOnNode#test_thread_for_recursion73,2807
|
164
|
-
|
165
|
-
test/test_tree.rb,6492
|
166
|
-
module TestTree::TestTree39,1725
|
167
|
-
class TestTreeNode::TestTree::TestTreeNode41,1777
|
168
|
-
def setup::TestTree::TestTreeNode#setup65,2610
|
169
|
-
def setup_test_tree::TestTree::TestTreeNode#setup_test_tree77,3030
|
170
|
-
def teardown::TestTree::TestTreeNode#teardown84,3180
|
171
|
-
def test_has_version_number::TestTree::TestTreeNode#test_has_version_number89,3272
|
172
|
-
def test_root_setup::TestTree::TestTreeNode#test_root_setup94,3423
|
173
|
-
def test_root::TestTree::TestTreeNode#test_root111,4473
|
174
|
-
def test_from_hash::TestTree::TestTreeNode#test_from_hash123,4974
|
175
|
-
def test_from_hash_with_nils::TestTree::TestTreeNode#test_from_hash_with_nils175,6546
|
176
|
-
def test_add_from_hash::TestTree::TestTreeNode#test_add_from_hash221,7902
|
177
|
-
def test_to_h::TestTree::TestTreeNode#test_to_h253,8917
|
178
|
-
def test_to_h_from_hash_symmetry::TestTree::TestTreeNode#test_to_h_from_hash_symmetry279,9496
|
179
|
-
def test_has_content_eh::TestTree::TestTreeNode#test_has_content_eh295,9894
|
180
|
-
def test_length_is_size::TestTree::TestTreeNode#test_length_is_size306,10352
|
181
|
-
def test_spaceship::TestTree::TestTreeNode#test_spaceship312,10542
|
182
|
-
def test_is_comparable::TestTree::TestTreeNode#test_is_comparable338,11325
|
183
|
-
def test_to_s::TestTree::TestTreeNode#test_to_s356,12107
|
184
|
-
def test_first_sibling::TestTree::TestTreeNode#test_first_sibling389,13825
|
185
|
-
def test_is_first_sibling_eh::TestTree::TestTreeNode#test_is_first_sibling_eh402,14553
|
186
|
-
def test_is_last_sibling_eh::TestTree::TestTreeNode#test_is_last_sibling_eh413,15036
|
187
|
-
def test_last_sibling::TestTree::TestTreeNode#test_last_sibling424,15504
|
188
|
-
def test_siblings::TestTree::TestTreeNode#test_siblings436,16158
|
189
|
-
def test_is_only_child_eh::TestTree::TestTreeNode#test_is_only_child_eh464,17081
|
190
|
-
def test_next_sibling::TestTree::TestTreeNode#test_next_sibling475,17517
|
191
|
-
def test_previous_sibling::TestTree::TestTreeNode#test_previous_sibling486,18017
|
192
|
-
def test_add::TestTree::TestTreeNode#test_add497,18546
|
193
|
-
def test_add_duplicate::TestTree::TestTreeNode#test_add_duplicate518,19228
|
194
|
-
def test_add_at_specific_position::TestTree::TestTreeNode#test_add_at_specific_position559,20656
|
195
|
-
def test_replace_bang::TestTree::TestTreeNode#test_replace_bang623,23711
|
196
|
-
def test_replace_with::TestTree::TestTreeNode#test_replace_with647,24756
|
197
|
-
def test_remove_bang::TestTree::TestTreeNode#test_remove_bang665,25481
|
198
|
-
def test_remove_all_bang::TestTree::TestTreeNode#test_remove_all_bang697,26444
|
199
|
-
def test_remove_from_parent_bang::TestTree::TestTreeNode#test_remove_from_parent_bang707,26750
|
200
|
-
def test_children::TestTree::TestTreeNode#test_children726,27465
|
201
|
-
def test_first_child::TestTree::TestTreeNode#test_first_child762,29054
|
202
|
-
def test_last_child::TestTree::TestTreeNode#test_last_child771,29382
|
203
|
-
def test_find::TestTree::TestTreeNode#test_find780,29698
|
204
|
-
def test_parentage::TestTree::TestTreeNode#test_parentage795,30293
|
205
|
-
def test_each::TestTree::TestTreeNode#test_each804,30625
|
206
|
-
def test_each_leaf::TestTree::TestTreeNode#test_each_leaf823,31309
|
207
|
-
def test_parent::TestTree::TestTreeNode#test_parent850,32504
|
208
|
-
def test_indexed_access::TestTree::TestTreeNode#test_indexed_access861,32923
|
209
|
-
def test_print_tree::TestTree::TestTreeNode#test_print_tree872,33296
|
210
|
-
def test_marshal_dump::TestTree::TestTreeNode#test_marshal_dump879,33456
|
211
|
-
alias test_marshal_load::TestTree::TestTreeNode#test_marshal_load921,35578
|
212
|
-
def test_collect::TestTree::TestTreeNode#test_collect924,35699
|
213
|
-
def test_freeze_tree_bang::TestTree::TestTreeNode#test_freeze_tree_bang934,35965
|
214
|
-
def test_content::TestTree::TestTreeNode#test_content948,36487
|
215
|
-
def test_depth::TestTree::TestTreeNode#test_depth956,36878
|
216
|
-
def do_deprecated_depth::TestTree::TestTreeNode#do_deprecated_depth967,37251
|
217
|
-
def test_node_height::TestTree::TestTreeNode#test_node_height985,37819
|
218
|
-
def test_node_depth::TestTree::TestTreeNode#test_node_depth1010,39028
|
219
|
-
def test_level::TestTree::TestTreeNode#test_level1023,39465
|
220
|
-
def test_breadth::TestTree::TestTreeNode#test_breadth1038,40008
|
221
|
-
def test_breadth_each::TestTree::TestTreeNode#test_breadth_each1057,40655
|
222
|
-
def test_preordered_each::TestTree::TestTreeNode#test_preordered_each1106,42240
|
223
|
-
def test_postordered_each::TestTree::TestTreeNode#test_postordered_each1145,43494
|
224
|
-
def test_detached_copy::TestTree::TestTreeNode#test_detached_copy1194,45031
|
225
|
-
def test_detached_subtree_copy::TestTree::TestTreeNode#test_detached_subtree_copy1211,45759
|
226
|
-
def test_has_children_eh::TestTree::TestTreeNode#test_has_children_eh1245,48011
|
227
|
-
def test_is_leaf_eh::TestTree::TestTreeNode#test_is_leaf_eh1251,48173
|
228
|
-
def test_is_root_eh::TestTree::TestTreeNode#test_is_root_eh1258,48379
|
229
|
-
def test_content_equals::TestTree::TestTreeNode#test_content_equals1264,48542
|
230
|
-
def test_size::TestTree::TestTreeNode#test_size1272,48807
|
231
|
-
def test_lt2::TestTree::TestTreeNode#test_lt21281,49071
|
232
|
-
def test_index::TestTree::TestTreeNode#test_index1292,49563
|
233
|
-
def test_in_degree::TestTree::TestTreeNode#test_in_degree1313,50659
|
234
|
-
def test_out_degree::TestTree::TestTreeNode#test_out_degree1324,51126
|
235
|
-
def test_json_serialization::TestTree::TestTreeNode#test_json_serialization1335,51613
|
236
|
-
def test_json_deserialization::TestTree::TestTreeNode#test_json_deserialization1359,52413
|
237
|
-
def test_json_roundtrip::TestTree::TestTreeNode#test_json_roundtrip1387,53599
|
238
|
-
def test_old_camelCase_method_names::TestTree::TestTreeNode#test_old_camelCase_method_names1403,54340
|
239
|
-
def test_integer_node_names::TestTree::TestTreeNode#test_integer_node_names1434,55408
|
240
|
-
def test_add_node_to_self_as_child::TestTree::TestTreeNode#test_add_node_to_self_as_child1465,56638
|
241
|
-
def test_single_node_becomes_leaf::TestTree::TestTreeNode#test_single_node_becomes_leaf1481,57151
|
242
|
-
def test_unique_node_names::TestTree::TestTreeNode#test_unique_node_names1493,57572
|
243
|
-
def setup_other_test_tree::TestTree::TestTreeNode#setup_other_test_tree1507,57927
|
244
|
-
def test_merge::TestTree::TestTreeNode#test_merge1535,58916
|
245
|
-
def test_merge_bang::TestTree::TestTreeNode#test_merge_bang1564,60354
|
246
|
-
def test_name_accessor::TestTree::TestTreeNode#test_name_accessor1589,61441
|
247
|
-
def test_rename::TestTree::TestTreeNode#test_rename1597,61657
|
248
|
-
def test_rename_child::TestTree::TestTreeNode#test_rename_child1608,62028
|
data/gem_graph.png
DELETED
Binary file
|
@@ -1,79 +0,0 @@
|
|
1
|
-
# camel_case_methods.rb - This file is part of the RubyTree package.
|
2
|
-
#
|
3
|
-
# = camel_case_methods.rb - Provides conversion from CamelCase to snake_case.
|
4
|
-
#
|
5
|
-
# Author:: Anupam Sengupta (anupamsg@gmail.com)
|
6
|
-
#
|
7
|
-
# Time-stamp: <2015-05-30 14:14:09 anupam>
|
8
|
-
#
|
9
|
-
# Copyright (C) 2012, 2013, 2015 Anupam Sengupta <anupamsg@gmail.com>
|
10
|
-
#
|
11
|
-
# All rights reserved.
|
12
|
-
#
|
13
|
-
# Redistribution and use in source and binary forms, with or without
|
14
|
-
# modification, are permitted provided that the following conditions are met:
|
15
|
-
#
|
16
|
-
# - Redistributions of source code must retain the above copyright notice, this
|
17
|
-
# list of conditions and the following disclaimer.
|
18
|
-
#
|
19
|
-
# - Redistributions in binary form must reproduce the above copyright notice,
|
20
|
-
# this list of conditions and the following disclaimer in the documentation
|
21
|
-
# and/or other materials provided with the distribution.
|
22
|
-
#
|
23
|
-
# - Neither the name of the organization nor the names of its contributors may
|
24
|
-
# be used to endorse or promote products derived from this software without
|
25
|
-
# specific prior written permission.
|
26
|
-
#
|
27
|
-
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
28
|
-
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
29
|
-
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
30
|
-
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
31
|
-
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
32
|
-
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
33
|
-
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
34
|
-
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
35
|
-
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
36
|
-
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
37
|
-
#
|
38
|
-
|
39
|
-
require 'structured_warnings'
|
40
|
-
|
41
|
-
module Tree::Utils
|
42
|
-
# Provides utility functions to handle CamelCase methods, and redirect
|
43
|
-
# invocation of such methods to the snake_case equivalents.
|
44
|
-
module CamelCaseMethodHandler
|
45
|
-
def self.included(base)
|
46
|
-
# @!visibility private
|
47
|
-
# Allow the deprecated CamelCase method names. Display a warning.
|
48
|
-
# :nodoc:
|
49
|
-
def method_missing(meth, *args, &blk)
|
50
|
-
if self.respond_to?(new_method_name = to_snake_case(meth))
|
51
|
-
warn DeprecatedMethodWarning,
|
52
|
-
"The camelCased methods are deprecated. "\
|
53
|
-
"Please use #{new_method_name} instead of #{meth}"
|
54
|
-
return send(new_method_name, *args, &blk)
|
55
|
-
else
|
56
|
-
super
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
private
|
61
|
-
|
62
|
-
# @!visibility private
|
63
|
-
# Convert a CamelCasedWord to a underscore separated camel_cased_word.
|
64
|
-
#
|
65
|
-
# @param [String] camel_cased_word The word to be converted to snake_case.
|
66
|
-
# @return [String] the snake_cased_word.
|
67
|
-
def to_snake_case(camel_cased_word)
|
68
|
-
word = camel_cased_word.to_s.dup
|
69
|
-
word.gsub!(/::/, '/')
|
70
|
-
word.gsub!(/([A-Z]+)([A-Z][a-z])/,'\1_\2')
|
71
|
-
word.gsub!(/([a-z\d])([A-Z])/,'\1_\2')
|
72
|
-
word.tr!("-", "_")
|
73
|
-
word.downcase!
|
74
|
-
word
|
75
|
-
end
|
76
|
-
|
77
|
-
end # self.included
|
78
|
-
end
|
79
|
-
end
|