rubytree 0.5.0 → 0.5.1
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.
- data/ChangeLog +8 -0
- data/README +25 -14
- data/TODO +7 -1
- data/lib/tree.rb +19 -10
- metadata +1 -1
data/ChangeLog
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
2007-12-19 Anupam Sengupta <anupamsg@gmail.com>
|
2
2
|
|
3
|
+
* README (Module): Modified the install instructions from source.
|
4
|
+
|
5
|
+
* lib/tree.rb (Tree::TreeNode::initialize): Removed the
|
6
|
+
unnecessary self_initialize method.
|
7
|
+
(Tree::TreeNode): Removed the spurious self_initialize from the
|
8
|
+
protected list.
|
9
|
+
(Module): Updated the minor version number.
|
10
|
+
|
3
11
|
* Rakefile: Fixed a problem with reading the Tree::VERSION for the
|
4
12
|
gem packaging, if any prior version of the gem is already installed.
|
5
13
|
|
data/README
CHANGED
@@ -1,36 +1,42 @@
|
|
1
|
-
|
1
|
+
|
2
|
+
__ _ _
|
3
|
+
/__\_ _| |__ _ _| |_ _ __ ___ ___
|
4
|
+
/ \// | | | '_ \| | | | __| '__/ _ \/ _ \
|
5
|
+
/ _ \ |_| | |_) | |_| | |_| | | __/ __/
|
6
|
+
\/ \_/\__,_|_.__/ \__, |\__|_| \___|\___|
|
7
|
+
|___/
|
2
8
|
|
3
9
|
(c) 2006, 2007 Anupam Sengupta
|
4
10
|
http://rubytree.rubyforge.org
|
5
11
|
|
6
|
-
== DESCRIPTION:
|
7
|
-
|
8
12
|
Rubytree is a simple implementation of the generic Tree data structure. This
|
9
13
|
implementation is node-centric, where the individual nodes on the tree are the
|
10
14
|
primary objects and drive the structure.
|
11
15
|
|
12
16
|
== INSTALL:
|
13
17
|
|
14
|
-
Rubytree is an open source project and is hosted at
|
15
|
-
|
18
|
+
Rubytree is an open source project and is hosted at:
|
19
|
+
|
20
|
+
http://rubytree.rubyforge.org
|
16
21
|
|
17
22
|
Rubytree can be downloaded as a Rubygem or as a tar/zip file from:
|
18
23
|
|
19
|
-
http://rubyforge.org/frs/?group_id=1215&release_id=8817
|
24
|
+
http://rubyforge.org/frs/?group_id=1215&release_id=8817
|
20
25
|
|
21
|
-
The file
|
26
|
+
The file-name is one of:
|
22
27
|
|
23
|
-
rubytree-<VERSION>.gem
|
24
|
-
rubytree-<VERSION>.tgz
|
25
|
-
rubytree-<VERSION>.zip
|
28
|
+
rubytree-<VERSION>.gem - The Rubygem
|
29
|
+
rubytree-<VERSION>.tgz - GZipped source files
|
30
|
+
rubytree-<VERSION>.zip - Zipped source files
|
26
31
|
|
27
|
-
Download the appropriate file-type.
|
32
|
+
Download the appropriate file-type for your system.
|
28
33
|
|
29
34
|
It is recommended to install Rubytree as a Ruby Gem, as this is an easy way to
|
30
35
|
keep the version updated, and keep multiple versions of the library available on
|
31
36
|
your system.
|
32
37
|
|
33
38
|
=== Installing the Gem
|
39
|
+
|
34
40
|
To Install the Gem, from a Terminal/CLI command prompt, issue the command:
|
35
41
|
|
36
42
|
gem install rubytree
|
@@ -40,8 +46,13 @@ super-user (root) to successfully install the gem.
|
|
40
46
|
|
41
47
|
=== Installing from the tgz/zip file
|
42
48
|
|
43
|
-
Extract the archive file (tgz or zip) and run the
|
44
|
-
top-level source directory
|
49
|
+
Extract the archive file (tgz or zip) and run the following command from the
|
50
|
+
top-level source directory:
|
51
|
+
|
52
|
+
ruby ./setup.rb
|
53
|
+
|
54
|
+
You may need administrator/super-user privileges to complete the setup using
|
55
|
+
this method.
|
45
56
|
|
46
57
|
== DOCUMENTATION:
|
47
58
|
|
@@ -133,4 +144,4 @@ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
133
144
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
134
145
|
|
135
146
|
|
136
|
-
(Document Revision: $Revision: 1.
|
147
|
+
(Document Revision: $Revision: 1.15 $ by $Author: anupamsg $)
|
data/TODO
CHANGED
data/lib/tree.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# tree.rb
|
2
2
|
#
|
3
|
-
# $Revision: 1.
|
3
|
+
# $Revision: 1.28 $ by $Author: anupamsg $
|
4
4
|
# $Name: $
|
5
5
|
#
|
6
6
|
# = tree.rb - Generic Multi-way Tree implementation
|
@@ -47,7 +47,8 @@
|
|
47
47
|
# This module mixes in the Enumerable module.
|
48
48
|
module Tree
|
49
49
|
|
50
|
-
|
50
|
+
# Rubytree Package Version
|
51
|
+
VERSION = '0.5.1'
|
51
52
|
|
52
53
|
# == TreeNode Class Description
|
53
54
|
#
|
@@ -116,11 +117,6 @@ module Tree
|
|
116
117
|
# The content can be of any type, and is defaulted to _nil_.
|
117
118
|
def initialize(name, content = nil)
|
118
119
|
raise "Node name HAS to be provided" if name == nil
|
119
|
-
self_initialize name, content
|
120
|
-
end
|
121
|
-
|
122
|
-
# A common initialization routine (also used by the marshalling code).
|
123
|
-
def self_initialize(name, content)
|
124
120
|
@name = name
|
125
121
|
@content = content
|
126
122
|
self.setAsRoot!
|
@@ -435,7 +431,7 @@ module Tree
|
|
435
431
|
self.collect { |node| node.createDumpRep }
|
436
432
|
end
|
437
433
|
|
438
|
-
# Creates a dump representation and returns the same as a hash
|
434
|
+
# Creates a dump representation and returns the same as a hash.
|
439
435
|
def createDumpRep
|
440
436
|
{ :name => @name, :parent => (isRoot? ? nil : @parent.name), :content => Marshal.dump(@content)}
|
441
437
|
end
|
@@ -454,7 +450,7 @@ module Tree
|
|
454
450
|
nodes[parent_name].add current_node
|
455
451
|
else
|
456
452
|
# This is the root node, hence initialize self.
|
457
|
-
|
453
|
+
initialize(name, content)
|
458
454
|
|
459
455
|
nodes[name] = self # Add self to the
|
460
456
|
end
|
@@ -475,12 +471,25 @@ module Tree
|
|
475
471
|
parent.children.size
|
476
472
|
end
|
477
473
|
|
478
|
-
protected :parent=, :setAsRoot!, :
|
474
|
+
protected :parent=, :setAsRoot!, :createDumpRep
|
479
475
|
|
480
476
|
end
|
481
477
|
end
|
482
478
|
|
483
479
|
# $Log: tree.rb,v $
|
480
|
+
# Revision 1.28 2007/12/20 03:19:33 anupamsg
|
481
|
+
# * README (Module): Modified the install instructions from source.
|
482
|
+
# (Module): Updated the minor version number.
|
483
|
+
#
|
484
|
+
# Revision 1.27 2007/12/20 03:00:03 anupamsg
|
485
|
+
# Minor code changes. Removed self_initialize from the protected methods' list.
|
486
|
+
#
|
487
|
+
# Revision 1.26 2007/12/20 02:50:04 anupamsg
|
488
|
+
# (Tree::TreeNode): Removed the spurious self_initialize from the protected list.
|
489
|
+
#
|
490
|
+
# Revision 1.25 2007/12/19 20:28:05 anupamsg
|
491
|
+
# Removed the unnecesary self_initialize method.
|
492
|
+
#
|
484
493
|
# Revision 1.24 2007/12/19 06:39:17 anupamsg
|
485
494
|
# Removed the unnecessary field and record separator constants. Also updated the
|
486
495
|
# history.txt file.
|