rubytree 0.8.1 → 0.8.2
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/.gemtest +0 -0
- data/History.txt +5 -0
- data/README +1 -1
- data/lib/tree.rb +4 -4
- data/test/test_tree.rb +25 -1
- metadata +16 -55
- data.tar.gz.sig +0 -1
- metadata.gz.sig +0 -2
data/.gemtest
ADDED
File without changes
|
data/History.txt
CHANGED
data/README
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
\/ \_/\__,_|_.__/ \__, |\__|_| \___|\___|
|
7
7
|
|___/
|
8
8
|
|
9
|
-
Copyright (c) 2006, 2007, 2008, 2009, 2010 Anupam Sengupta (anupamsg at gmail dot com)
|
9
|
+
Copyright (c) 2006, 2007, 2008, 2009, 2010, 2011 Anupam Sengupta (anupamsg at gmail dot com)
|
10
10
|
|
11
11
|
http://rubytree.rubyforge.org
|
12
12
|
|
data/lib/tree.rb
CHANGED
@@ -11,7 +11,7 @@
|
|
11
11
|
# Author:: Anupam Sengupta (anupamsg@gmail.com)
|
12
12
|
#
|
13
13
|
|
14
|
-
# Copyright (c) 2006, 2007, 2008, 2009, 2010 Anupam Sengupta
|
14
|
+
# Copyright (c) 2006, 2007, 2008, 2009, 2010, 2011 Anupam Sengupta
|
15
15
|
#
|
16
16
|
# All rights reserved.
|
17
17
|
#
|
@@ -48,7 +48,7 @@
|
|
48
48
|
module Tree
|
49
49
|
|
50
50
|
# Rubytree Package Version
|
51
|
-
VERSION = '0.8.
|
51
|
+
VERSION = '0.8.2'
|
52
52
|
|
53
53
|
# == TreeNode Class Description
|
54
54
|
#
|
@@ -184,8 +184,8 @@ module Tree
|
|
184
184
|
# @return [String] A string representation of the node.
|
185
185
|
def to_s
|
186
186
|
"Node Name: #{@name}" +
|
187
|
-
" Content: " + (@content || "<Empty>") +
|
188
|
-
" Parent: " + (is_root?() ? "<None>" : @parent.name) +
|
187
|
+
" Content: " + (@content.to_s || "<Empty>") +
|
188
|
+
" Parent: " + (is_root?() ? "<None>" : @parent.name.to_s) +
|
189
189
|
" Children: #{@children.length}" +
|
190
190
|
" Total Nodes: #{size()}"
|
191
191
|
end
|
data/test/test_tree.rb
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
#
|
5
5
|
# $Revision$ by $Author$ on $Date$
|
6
6
|
#
|
7
|
-
# Copyright (c) 2006, 2007, 2008, 2009, 2010 Anupam Sengupta
|
7
|
+
# Copyright (c) 2006, 2007, 2008, 2009, 2010, 2011 Anupam Sengupta
|
8
8
|
#
|
9
9
|
# All rights reserved.
|
10
10
|
#
|
@@ -164,6 +164,30 @@ module TestTree
|
|
164
164
|
expected_string = "Node Name: A Node Content: Some Content Parent: <None> Children: 0 Total Nodes: 1"
|
165
165
|
|
166
166
|
assert_equal(expected_string, a_node.to_s, "The string representation should be same")
|
167
|
+
|
168
|
+
# Now test with a symbol as a key.
|
169
|
+
a_node = Tree::TreeNode.new(:Node_Name, "Some Content")
|
170
|
+
expected_string = "Node Name: Node_Name Content: Some Content Parent: <None> Children: 0 Total Nodes: 1"
|
171
|
+
assert_equal(expected_string, a_node.to_s, "The string representation should be same")
|
172
|
+
|
173
|
+
# Now test with a symbol as a key and another symbol as the content.
|
174
|
+
a_node = Tree::TreeNode.new(:Node_Name, :Content)
|
175
|
+
expected_string = "Node Name: Node_Name Content: Content Parent: <None> Children: 0 Total Nodes: 1"
|
176
|
+
assert_equal(expected_string, a_node.to_s, "The string representation should be same")
|
177
|
+
|
178
|
+
# Now test with a symbol as a key, and a hash as the content.
|
179
|
+
a_hash = {:a_key => "Some Value"}
|
180
|
+
a_node = Tree::TreeNode.new(:Node_Name, a_hash)
|
181
|
+
expected_string = "Node Name: Node_Name Content: #{a_hash} Parent: <None> Children: 0 Total Nodes: 1"
|
182
|
+
assert_equal(expected_string, a_node.to_s, "The string representation should be same")
|
183
|
+
|
184
|
+
# Lets now add a child to the previous node, and test the to_s for the child
|
185
|
+
child_node = Tree::TreeNode.new(:Child_node, "Child Node")
|
186
|
+
a_node << child_node
|
187
|
+
|
188
|
+
expected_string = "Node Name: Child_node Content: Child Node Parent: Node_Name Children: 0 Total Nodes: 1"
|
189
|
+
assert_equal(expected_string, child_node.to_s, "The string representation should be same")
|
190
|
+
|
167
191
|
end
|
168
192
|
|
169
193
|
# Test the first_sibling method.
|
metadata
CHANGED
@@ -1,64 +1,26 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubytree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 59
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 8
|
9
|
-
-
|
10
|
-
version: 0.8.
|
9
|
+
- 2
|
10
|
+
version: 0.8.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Anupam Sengupta
|
14
14
|
autorequire:
|
15
15
|
bindir: bin
|
16
|
-
cert_chain:
|
17
|
-
- |
|
18
|
-
-----BEGIN CERTIFICATE-----
|
19
|
-
MIIDMjCCAhqgAwIBAgIBADANBgkqhkiG9w0BAQUFADA/MREwDwYDVQQDDAhhbnVw
|
20
|
-
YW1zZzEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYDY29t
|
21
|
-
MB4XDTEwMDkyODIwMzExOFoXDTExMDkyODIwMzExOFowPzERMA8GA1UEAwwIYW51
|
22
|
-
cGFtc2cxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkWA2Nv
|
23
|
-
bTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAPf87wKYt5whj50qYVw2
|
24
|
-
gZ3xDKK5pNxJFhxHanrRWhk3JURGJjM9jk9i2Ei4eDYzSf/sYpGAMIXjISOp5p8Y
|
25
|
-
0Ihw7jN7b7doxpayIvo+h66N5RdIVXGK5+hWynuqumTs577+97eS93Kx4v1cDWXv
|
26
|
-
M9ENYykowwe2b+TlsqvIMeGfGNX6dtnP5MjmlAyZdSlMHqj/m5a6tSDWCwIrwJjA
|
27
|
-
EY0iwIvRlqssuvKPxH2skK4Fh22H179tCswoZfpvG1L6UzrZDWCZ8Ane/azXmTNs
|
28
|
-
gV6/xwXdApf9Pbcz6M1glk1+bqeh40K7g4Vn74qVKWBGN+dOxV25VWZDRbHfpWJw
|
29
|
-
Sc8CAwEAAaM5MDcwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFAaE
|
30
|
-
AJueWTN4Jk2eSqVTEtcwJsGaMA0GCSqGSIb3DQEBBQUAA4IBAQACRDVp7B9IX5bg
|
31
|
-
XzjyPpp0flo50sn1ckN8Tp+2JW9m5AYjqis8kDHSfIkde8Qem3lPP1dMyuLoLr/f
|
32
|
-
Rm2VTLF6ANCTTghezqcF71g64WdYm4sHRJ7HWk1U4O7OI/FlsU1rV4ci+myU+GYT
|
33
|
-
Bugm4xj1CQcQ26CbmRFaDUelQmAt2BVC4bknZPDMbAbBIr9EOr6H5DvURMS6Vieg
|
34
|
-
xQGekdJ942Ue5hphzV2o4Zwm5R0qPjqhnRO1MXtdjly1YCFtbN3XZ6ijMSLBvzRq
|
35
|
-
Y+h3eilU09UAlB+ozLJKjYMrnkFJH7f0gNt0+5iUG5vP+3aaIXyP3bOIKe9YAuPa
|
36
|
-
MVN7wJio
|
37
|
-
-----END CERTIFICATE-----
|
16
|
+
cert_chain: []
|
38
17
|
|
39
|
-
date:
|
40
|
-
default_executable:
|
18
|
+
date: 2011-12-16 00:00:00 Z
|
41
19
|
dependencies:
|
42
|
-
- !ruby/object:Gem::Dependency
|
43
|
-
name: rubyforge
|
44
|
-
prerelease: false
|
45
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
46
|
-
none: false
|
47
|
-
requirements:
|
48
|
-
- - ">="
|
49
|
-
- !ruby/object:Gem::Version
|
50
|
-
hash: 7
|
51
|
-
segments:
|
52
|
-
- 2
|
53
|
-
- 0
|
54
|
-
- 4
|
55
|
-
version: 2.0.4
|
56
|
-
type: :development
|
57
|
-
version_requirements: *id001
|
58
20
|
- !ruby/object:Gem::Dependency
|
59
21
|
name: hoe-yard
|
60
22
|
prerelease: false
|
61
|
-
requirement: &
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
62
24
|
none: false
|
63
25
|
requirements:
|
64
26
|
- - ">="
|
@@ -70,23 +32,22 @@ dependencies:
|
|
70
32
|
- 2
|
71
33
|
version: 0.1.2
|
72
34
|
type: :development
|
73
|
-
version_requirements: *
|
35
|
+
version_requirements: *id001
|
74
36
|
- !ruby/object:Gem::Dependency
|
75
37
|
name: hoe
|
76
38
|
prerelease: false
|
77
|
-
requirement: &
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
78
40
|
none: false
|
79
41
|
requirements:
|
80
|
-
- -
|
42
|
+
- - ~>
|
81
43
|
- !ruby/object:Gem::Version
|
82
|
-
hash:
|
44
|
+
hash: 27
|
83
45
|
segments:
|
84
46
|
- 2
|
85
|
-
-
|
86
|
-
|
87
|
-
version: 2.6.2
|
47
|
+
- 12
|
48
|
+
version: "2.12"
|
88
49
|
type: :development
|
89
|
-
version_requirements: *
|
50
|
+
version_requirements: *id002
|
90
51
|
description: |-
|
91
52
|
RubyTree is a Ruby implementation of the generic tree data structure. It provides a node-based model to store keyed
|
92
53
|
node-elements in the tree and simple APIs to access, modify and traverse the structure. RubyTree is node-centric, where
|
@@ -117,7 +78,7 @@ files:
|
|
117
78
|
- setup.rb
|
118
79
|
- test/test_binarytree.rb
|
119
80
|
- test/test_tree.rb
|
120
|
-
|
81
|
+
- .gemtest
|
121
82
|
homepage: http://rubytree.rubyforge.org
|
122
83
|
licenses: []
|
123
84
|
|
@@ -169,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
169
130
|
requirements: []
|
170
131
|
|
171
132
|
rubyforge_project: rubytree
|
172
|
-
rubygems_version: 1.
|
133
|
+
rubygems_version: 1.8.10
|
173
134
|
signing_key:
|
174
135
|
specification_version: 3
|
175
136
|
summary: RubyTree is a Ruby implementation of the generic tree data structure
|
data.tar.gz.sig
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
ܥ**�]ڏ�)�5"����qƵtܣ�g��Fl]t�߉���8?��)��������Bl"3mj(˳~�"U<_�M="�J�>�ݚ�K�1�h�Hgaw(�,���)T9�N��ⶎ�ڙ���P-q���U������)��u��T�e��>-��l�H�{�`,���Cn6� ow�x��q�(k'g`��{pɆ^u�4��&xGQ��E�DP*�.`���F?�m��m>+��W��C���U�f%u��2z\0�
|
metadata.gz.sig
DELETED