red_grape 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.autotest +23 -0
- data/.gemtest +0 -0
- data/History.txt +6 -0
- data/Manifest.txt +32 -0
- data/README.txt +59 -0
- data/Rakefile +19 -0
- data/bin/red_grape +3 -0
- data/data/graph-example-1.xml +54 -0
- data/lib/red_grape/edge.rb +34 -0
- data/lib/red_grape/graph.rb +139 -0
- data/lib/red_grape/path_group.rb +16 -0
- data/lib/red_grape/pipe/as_pipe.rb +36 -0
- data/lib/red_grape/pipe/back_pipe.rb +25 -0
- data/lib/red_grape/pipe/base.rb +83 -0
- data/lib/red_grape/pipe/context.rb +34 -0
- data/lib/red_grape/pipe/filter_pipe.rb +22 -0
- data/lib/red_grape/pipe/if_then_else_pipe.rb +27 -0
- data/lib/red_grape/pipe/in_pipe.rb +31 -0
- data/lib/red_grape/pipe/loop_pipe.rb +39 -0
- data/lib/red_grape/pipe/out_pipe.rb +37 -0
- data/lib/red_grape/pipe/paths_pipe.rb +24 -0
- data/lib/red_grape/pipe/property_pipe.rb +25 -0
- data/lib/red_grape/pipe/side_effect_pipe.rb +23 -0
- data/lib/red_grape/pipe/transform_pipe.rb +21 -0
- data/lib/red_grape/propertied_object.rb +46 -0
- data/lib/red_grape/property_description.rb +47 -0
- data/lib/red_grape/vertex.rb +46 -0
- data/lib/red_grape/vertex_group.rb +72 -0
- data/lib/red_grape.rb +31 -0
- data/test/test_graph.rb +80 -0
- data/test/test_on_the_nature_of_pipes.rb +101 -0
- data/test/test_propertied_object.rb +42 -0
- data/test/test_red_grape.rb +8 -0
- data/test/test_traversal_patterns.rb +18 -0
- data/test/test_vertex.rb +34 -0
- metadata +114 -0
data/test/test_vertex.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'red_grape'
|
3
|
+
|
4
|
+
class VertexTest < Test::Unit::TestCase
|
5
|
+
def test_to_s
|
6
|
+
id = '12345'
|
7
|
+
g = RedGrape::Graph.new
|
8
|
+
v = RedGrape::Vertex.new g, id
|
9
|
+
assert_equal "v[#{id}]", v.to_s
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_set_property
|
13
|
+
g = RedGrape::Graph.new
|
14
|
+
v = RedGrape::Vertex.new g, '1234', property_description:{
|
15
|
+
name:RedGrape::PropertyDescription.new('name', 'string'),
|
16
|
+
sex:RedGrape::PropertyDescription.new('sex', 'string', 'male'),
|
17
|
+
age:RedGrape::PropertyDescription.new('age', 'integer')
|
18
|
+
}
|
19
|
+
v.set_property :name, 'hello'
|
20
|
+
assert_equal 'hello', v[:name]
|
21
|
+
assert_equal 'male', v[:sex]
|
22
|
+
assert_raise(ArgumentError) {v.set_property :age, 'not integer'}
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_method_missing
|
26
|
+
g = RedGrape::Graph.new
|
27
|
+
v = RedGrape::Vertex.new g, '12345'
|
28
|
+
v[:name] = 'yasushi'
|
29
|
+
assert_equal 'yasushi', v[:name]
|
30
|
+
assert_equal 'yasushi', v['name']
|
31
|
+
assert_equal 'yasushi', v.name
|
32
|
+
assert_raise(NoMethodError) {v.no_attr}
|
33
|
+
end
|
34
|
+
end
|
metadata
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: red_grape
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- ANDO Yasushi
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-05-19 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rdoc
|
16
|
+
requirement: &70266408089740 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '3.10'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70266408089740
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: hoe
|
27
|
+
requirement: &70266408089300 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ~>
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '3.0'
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70266408089300
|
36
|
+
description: RedGrape is an in-memory graph database written in ruby.
|
37
|
+
email:
|
38
|
+
- andyjpn@gmail.com
|
39
|
+
executables:
|
40
|
+
- red_grape
|
41
|
+
extensions: []
|
42
|
+
extra_rdoc_files:
|
43
|
+
- History.txt
|
44
|
+
- Manifest.txt
|
45
|
+
- README.txt
|
46
|
+
files:
|
47
|
+
- .autotest
|
48
|
+
- History.txt
|
49
|
+
- Manifest.txt
|
50
|
+
- README.txt
|
51
|
+
- Rakefile
|
52
|
+
- bin/red_grape
|
53
|
+
- data/graph-example-1.xml
|
54
|
+
- lib/red_grape/edge.rb
|
55
|
+
- lib/red_grape/graph.rb
|
56
|
+
- lib/red_grape/path_group.rb
|
57
|
+
- lib/red_grape/pipe/as_pipe.rb
|
58
|
+
- lib/red_grape/pipe/back_pipe.rb
|
59
|
+
- lib/red_grape/pipe/base.rb
|
60
|
+
- lib/red_grape/pipe/context.rb
|
61
|
+
- lib/red_grape/pipe/filter_pipe.rb
|
62
|
+
- lib/red_grape/pipe/if_then_else_pipe.rb
|
63
|
+
- lib/red_grape/pipe/in_pipe.rb
|
64
|
+
- lib/red_grape/pipe/loop_pipe.rb
|
65
|
+
- lib/red_grape/pipe/out_pipe.rb
|
66
|
+
- lib/red_grape/pipe/paths_pipe.rb
|
67
|
+
- lib/red_grape/pipe/property_pipe.rb
|
68
|
+
- lib/red_grape/pipe/side_effect_pipe.rb
|
69
|
+
- lib/red_grape/pipe/transform_pipe.rb
|
70
|
+
- lib/red_grape/propertied_object.rb
|
71
|
+
- lib/red_grape/property_description.rb
|
72
|
+
- lib/red_grape/vertex.rb
|
73
|
+
- lib/red_grape/vertex_group.rb
|
74
|
+
- lib/red_grape.rb
|
75
|
+
- test/test_on_the_nature_of_pipes.rb
|
76
|
+
- test/test_red_grape.rb
|
77
|
+
- test/test_graph.rb
|
78
|
+
- test/test_propertied_object.rb
|
79
|
+
- test/test_traversal_patterns.rb
|
80
|
+
- test/test_vertex.rb
|
81
|
+
- .gemtest
|
82
|
+
homepage: https://github.com/technohippy/red-grape
|
83
|
+
licenses: []
|
84
|
+
post_install_message:
|
85
|
+
rdoc_options:
|
86
|
+
- --main
|
87
|
+
- README.txt
|
88
|
+
require_paths:
|
89
|
+
- lib
|
90
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
91
|
+
none: false
|
92
|
+
requirements:
|
93
|
+
- - ! '>='
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
requirements: []
|
103
|
+
rubyforge_project: red_grape
|
104
|
+
rubygems_version: 1.8.10
|
105
|
+
signing_key:
|
106
|
+
specification_version: 3
|
107
|
+
summary: RedGrape is an in-memory graph database written in ruby.
|
108
|
+
test_files:
|
109
|
+
- test/test_graph.rb
|
110
|
+
- test/test_on_the_nature_of_pipes.rb
|
111
|
+
- test/test_propertied_object.rb
|
112
|
+
- test/test_red_grape.rb
|
113
|
+
- test/test_traversal_patterns.rb
|
114
|
+
- test/test_vertex.rb
|