hyrarchy 0.3.3
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/LICENSE +20 -0
- data/README.rdoc +69 -0
- data/lib/hyrarchy.rb +321 -0
- data/lib/hyrarchy/awesome_nested_set_compatibility.rb +375 -0
- data/lib/hyrarchy/collection_proxy.rb +75 -0
- data/lib/hyrarchy/encoded_path.rb +111 -0
- data/rails_plugin/init.rb +2 -0
- data/spec/create_nodes_table.rb +25 -0
- data/spec/database.yml +10 -0
- data/spec/hyrarchy_spec.rb +184 -0
- data/spec/spec_helper.rb +52 -0
- data/test/encoded_path_test.rb +31 -0
- data/test/test_helper.rb +6 -0
- metadata +82 -0
@@ -0,0 +1,31 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'test_helper')
|
2
|
+
|
3
|
+
class EncodedPathTests < Test::Unit::TestCase
|
4
|
+
def setup
|
5
|
+
@path = Hyrarchy::EncodedPath(5, 7)
|
6
|
+
end
|
7
|
+
|
8
|
+
def test_next_farey_fraction
|
9
|
+
assert_equal(Rational(3, 4), @path.send(:next_farey_fraction))
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_mediant
|
13
|
+
assert_equal(Rational(15, 20), @path.send(:mediant, Rational(10, 13)))
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_parent
|
17
|
+
assert_equal(Rational(2, 3), @path.parent)
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_depth
|
21
|
+
assert_equal(3, @path.depth)
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_first_child
|
25
|
+
assert_equal(Rational(8, 11), @path.first_child)
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_next_sibling
|
29
|
+
assert_equal(Rational(7, 10), @path.next_sibling)
|
30
|
+
end
|
31
|
+
end
|
data/test/test_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: hyrarchy
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 3
|
8
|
+
- 3
|
9
|
+
version: 0.3.3
|
10
|
+
platform: ruby
|
11
|
+
authors:
|
12
|
+
- Dana Contreras
|
13
|
+
autorequire:
|
14
|
+
bindir: bin
|
15
|
+
cert_chain: []
|
16
|
+
|
17
|
+
date: 2010-03-27 00:00:00 -04:00
|
18
|
+
default_executable:
|
19
|
+
dependencies: []
|
20
|
+
|
21
|
+
description:
|
22
|
+
email:
|
23
|
+
executables: []
|
24
|
+
|
25
|
+
extensions: []
|
26
|
+
|
27
|
+
extra_rdoc_files:
|
28
|
+
- README.rdoc
|
29
|
+
- LICENSE
|
30
|
+
files:
|
31
|
+
- lib/hyrarchy.rb
|
32
|
+
- lib/hyrarchy/collection_proxy.rb
|
33
|
+
- lib/hyrarchy/encoded_path.rb
|
34
|
+
- lib/hyrarchy/awesome_nested_set_compatibility.rb
|
35
|
+
- rails_plugin/init.rb
|
36
|
+
- README.rdoc
|
37
|
+
- spec/create_nodes_table.rb
|
38
|
+
- spec/database.yml
|
39
|
+
- spec/hyrarchy_spec.rb
|
40
|
+
- spec/spec_helper.rb
|
41
|
+
- test/encoded_path_test.rb
|
42
|
+
- test/test_helper.rb
|
43
|
+
- LICENSE
|
44
|
+
has_rdoc: true
|
45
|
+
homepage: http://github.com/DanaDanger/hyrarchy
|
46
|
+
licenses: []
|
47
|
+
|
48
|
+
post_install_message:
|
49
|
+
rdoc_options:
|
50
|
+
- --all
|
51
|
+
- --inline-source
|
52
|
+
- --line-numbers
|
53
|
+
require_paths:
|
54
|
+
- lib
|
55
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
segments:
|
60
|
+
- 0
|
61
|
+
version: "0"
|
62
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
segments:
|
67
|
+
- 0
|
68
|
+
version: "0"
|
69
|
+
requirements: []
|
70
|
+
|
71
|
+
rubyforge_project:
|
72
|
+
rubygems_version: 1.3.6
|
73
|
+
signing_key:
|
74
|
+
specification_version: 3
|
75
|
+
summary: A gem and Rails plugin for working with hierarchic data.
|
76
|
+
test_files:
|
77
|
+
- spec/create_nodes_table.rb
|
78
|
+
- spec/database.yml
|
79
|
+
- spec/hyrarchy_spec.rb
|
80
|
+
- spec/spec_helper.rb
|
81
|
+
- test/encoded_path_test.rb
|
82
|
+
- test/test_helper.rb
|