yargi 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,50 +1,78 @@
1
1
  digraph G {
2
2
  graph[rankdir="LR"]
3
- V0 [fontsize="16" shape="folder" style="filled" fillcolor="cornsilk2" file="/Users/blambeau/work/chefbe/devel/yargi" width="1.6" label="yargi" height="0.4" fontname="Arial"]
4
- V1 [fontsize="16" shape="box" fontcolor="white" style="filled, rounded" fillcolor="gray25" file="/Users/blambeau/work/chefbe/devel/yargi/CONTRIBUTE" width="1.6" label="CONTRIBUTE (0 kb)" height="0.4" fontname="Arial"]
5
- V2 [fontsize="16" shape="folder" style="filled" fillcolor="white" file="/Users/blambeau/work/chefbe/devel/yargi/doc" width="1.6" label="doc" height="0.4" fontname="Arial"]
6
- V3 [fontsize="16" shape="folder" fontcolor="black" style="filled" fillcolor="gold" file="/Users/blambeau/work/chefbe/devel/yargi/examples" width="1.6" label="examples" height="0.4" fontname="Arial"]
7
- V4 [fontsize="16" shape="box" style="filled, rounded" file="/Users/blambeau/work/chefbe/devel/yargi/examples/fs2dot.dot" width="1.6" label="fs2dot.dot (5 kb)" height="0.4" fontname="Arial"]
8
- V5 [fontsize="16" shape="box" style="filled, rounded" file="/Users/blambeau/work/chefbe/devel/yargi/examples/fs2dot.gif" width="1.6" label="fs2dot.gif (42 kb)" height="0.4" fontname="Arial"]
9
- V6 [fontsize="16" shape="parallelogram" fontcolor="white" style="filled, rounded" fillcolor="blue4" file="/Users/blambeau/work/chefbe/devel/yargi/examples/fs2dot.rb" width="1.6" label="fs2dot.rb (1 kb)" height="0.4" fontname="Arial"]
10
- V7 [fontsize="16" shape="folder" fontcolor="black" style="filled" fillcolor="gold" file="/Users/blambeau/work/chefbe/devel/yargi/lib" width="1.6" label="lib" height="0.4" fontname="Arial"]
11
- V8 [fontsize="16" shape="folder" fontcolor="black" style="filled" fillcolor="gold" file="/Users/blambeau/work/chefbe/devel/yargi/lib/yargi" width="1.6" label="yargi" height="0.4" fontname="Arial"]
12
- V9 [fontsize="16" shape="parallelogram" fontcolor="white" style="filled, rounded" fillcolor="blue4" file="/Users/blambeau/work/chefbe/devel/yargi/lib/yargi/digraph.rb" width="1.6" label="digraph.rb (9 kb)" height="0.4" fontname="Arial"]
13
- V10 [fontsize="16" shape="parallelogram" fontcolor="white" style="filled, rounded" fillcolor="blue4" file="/Users/blambeau/work/chefbe/devel/yargi/lib/yargi/digraph_edge.rb" width="1.6" label="digraph_edge.rb (2 kb)" height="0.4" fontname="Arial"]
14
- V11 [fontsize="16" shape="parallelogram" fontcolor="white" style="filled, rounded" fillcolor="blue4" file="/Users/blambeau/work/chefbe/devel/yargi/lib/yargi/digraph_vertex.rb" width="1.6" label="digraph_vertex.rb (2 kb)" height="0.4" fontname="Arial"]
15
- V12 [fontsize="16" shape="parallelogram" fontcolor="white" style="filled, rounded" fillcolor="blue4" file="/Users/blambeau/work/chefbe/devel/yargi/lib/yargi/edge_set.rb" width="1.6" label="edge_set.rb (0 kb)" height="0.4" fontname="Arial"]
16
- V13 [fontsize="16" shape="parallelogram" fontcolor="white" style="filled, rounded" fillcolor="blue4" file="/Users/blambeau/work/chefbe/devel/yargi/lib/yargi/element_set.rb" width="1.6" label="element_set.rb (4 kb)" height="0.4" fontname="Arial"]
17
- V14 [fontsize="16" shape="parallelogram" fontcolor="white" style="filled, rounded" fillcolor="blue4" file="/Users/blambeau/work/chefbe/devel/yargi/lib/yargi/markable.rb" width="1.6" label="markable.rb (1 kb)" height="0.4" fontname="Arial"]
18
- V15 [fontsize="16" shape="parallelogram" fontcolor="white" style="filled, rounded" fillcolor="blue4" file="/Users/blambeau/work/chefbe/devel/yargi/lib/yargi/predicate.rb" width="1.6" label="predicate.rb (4 kb)" height="0.4" fontname="Arial"]
19
- V16 [fontsize="16" shape="parallelogram" fontcolor="white" style="filled, rounded" fillcolor="blue4" file="/Users/blambeau/work/chefbe/devel/yargi/lib/yargi/vertex_set.rb" width="1.6" label="vertex_set.rb (1 kb)" height="0.4" fontname="Arial"]
20
- V17 [fontsize="16" shape="parallelogram" fontcolor="white" style="filled, rounded" fillcolor="blue4" file="/Users/blambeau/work/chefbe/devel/yargi/lib/yargi.rb" width="1.6" label="yargi.rb (0 kb)" height="0.4" fontname="Arial"]
21
- V18 [fontsize="16" shape="box" fontcolor="white" style="filled, rounded" fillcolor="gray25" file="/Users/blambeau/work/chefbe/devel/yargi/LICENCE" width="1.6" label="LICENCE (1 kb)" height="0.4" fontname="Arial"]
22
- V19 [fontsize="16" shape="folder" style="filled" fillcolor="cornsilk2" file="/Users/blambeau/work/chefbe/devel/yargi/pkg" width="1.6" label="pkg" height="0.4" fontname="Arial"]
23
- V20 [fontsize="16" shape="box3d" style="filled, rounded" fillcolor="gold" file="/Users/blambeau/work/chefbe/devel/yargi/pkg/yargi-0.1.0.gem" width="1.6" label="yargi-0.1.0.gem (91 kb)" height="0.4" fontname="Arial"]
24
- V21 [fontsize="16" shape="box" style="filled, rounded" file="/Users/blambeau/work/chefbe/devel/yargi/Rakefile" width="1.6" label="Rakefile (1 kb)" height="0.4" fontname="Arial"]
25
- V22 [fontsize="16" shape="box" fontcolor="white" style="filled, rounded" fillcolor="gray25" file="/Users/blambeau/work/chefbe/devel/yargi/README" width="1.6" label="README (5 kb)" height="0.4" fontname="Arial"]
26
- V23 [fontsize="16" shape="folder" style="filled" fillcolor="white" file="/Users/blambeau/work/chefbe/devel/yargi/test" width="1.6" label="test" height="0.4" fontname="Arial"]
27
- V3 -> V4 []
28
- V3 -> V5 []
29
- V3 -> V6 []
30
- V8 -> V9 []
31
- V8 -> V10 []
32
- V8 -> V11 []
33
- V8 -> V12 []
34
- V8 -> V13 []
35
- V8 -> V14 []
36
- V8 -> V15 []
37
- V8 -> V16 []
38
- V7 -> V8 []
39
- V7 -> V17 []
40
- V19 -> V20 []
3
+ V0 [file="/home/blambeau/work/devel/yargi" shape="folder" width="1.6" height="0.4" fontname="Arial" fontsize="16" style="filled" fillcolor="cornsilk2" label="yargi"]
4
+ V1 [file="/home/blambeau/work/devel/yargi/CHANGELOG.md" shape="box" width="1.6" height="0.4" fontname="Arial" fontsize="16" style="filled, rounded" label="CHANGELOG.md (0 kb)"]
5
+ V2 [file="/home/blambeau/work/devel/yargi/README.md" shape="box" width="1.6" height="0.4" fontname="Arial" fontsize="16" style="filled, rounded" label="README.md (3 kb)"]
6
+ V3 [file="/home/blambeau/work/devel/yargi/Manifest.txt" shape="box" width="1.6" height="0.4" fontname="Arial" fontsize="16" style="filled, rounded" label="Manifest.txt (0 kb)"]
7
+ V4 [file="/home/blambeau/work/devel/yargi/yargi.noespec" shape="box" width="1.6" height="0.4" fontname="Arial" fontsize="16" style="filled, rounded" label="yargi.noespec (1 kb)"]
8
+ V5 [file="/home/blambeau/work/devel/yargi/Rakefile" shape="box" width="1.6" height="0.4" fontname="Arial" fontsize="16" style="filled, rounded" label="Rakefile (0 kb)"]
9
+ V6 [file="/home/blambeau/work/devel/yargi/examples" shape="folder" width="1.6" height="0.4" fontname="Arial" fontsize="16" style="filled" fillcolor="gold" label="examples" fontcolor="black"]
10
+ V7 [file="/home/blambeau/work/devel/yargi/examples/fs2dot.dot" shape="box" width="1.6" height="0.4" fontname="Arial" fontsize="16" style="filled, rounded" label="fs2dot.dot (7 kb)"]
11
+ V8 [file="/home/blambeau/work/devel/yargi/examples/fs2dot.rb" shape="parallelogram" width="1.6" height="0.4" fontname="Arial" fontsize="16" style="filled, rounded" label="fs2dot.rb (1 kb)" fillcolor="blue4" fontcolor="white"]
12
+ V9 [file="/home/blambeau/work/devel/yargi/Gemfile.lock" shape="box" width="1.6" height="0.4" fontname="Arial" fontsize="16" style="filled, rounded" label="Gemfile.lock (0 kb)"]
13
+ V10 [file="/home/blambeau/work/devel/yargi/lib" shape="folder" width="1.6" height="0.4" fontname="Arial" fontsize="16" style="filled" fillcolor="gold" label="lib" fontcolor="black"]
14
+ V11 [file="/home/blambeau/work/devel/yargi/lib/yargi.rb" shape="parallelogram" width="1.6" height="0.4" fontname="Arial" fontsize="16" style="filled, rounded" label="yargi.rb (0 kb)" fillcolor="blue4" fontcolor="white"]
15
+ V12 [file="/home/blambeau/work/devel/yargi/lib/yargi" shape="folder" width="1.6" height="0.4" fontname="Arial" fontsize="16" style="filled" fillcolor="gold" label="yargi" fontcolor="black"]
16
+ V13 [file="/home/blambeau/work/devel/yargi/lib/yargi/element_set.rb" shape="parallelogram" width="1.6" height="0.4" fontname="Arial" fontsize="16" style="filled, rounded" label="element_set.rb (4 kb)" fillcolor="blue4" fontcolor="white"]
17
+ V14 [file="/home/blambeau/work/devel/yargi/lib/yargi/predicate.rb" shape="parallelogram" width="1.6" height="0.4" fontname="Arial" fontsize="16" style="filled, rounded" label="predicate.rb (4 kb)" fillcolor="blue4" fontcolor="white"]
18
+ V15 [file="/home/blambeau/work/devel/yargi/lib/yargi/digraph_edge.rb" shape="parallelogram" width="1.6" height="0.4" fontname="Arial" fontsize="16" style="filled, rounded" label="digraph_edge.rb (2 kb)" fillcolor="blue4" fontcolor="white"]
19
+ V16 [file="/home/blambeau/work/devel/yargi/lib/yargi/digraph.rb" shape="parallelogram" width="1.6" height="0.4" fontname="Arial" fontsize="16" style="filled, rounded" label="digraph.rb (9 kb)" fillcolor="blue4" fontcolor="white"]
20
+ V17 [file="/home/blambeau/work/devel/yargi/lib/yargi/edge_set.rb" shape="parallelogram" width="1.6" height="0.4" fontname="Arial" fontsize="16" style="filled, rounded" label="edge_set.rb (1 kb)" fillcolor="blue4" fontcolor="white"]
21
+ V18 [file="/home/blambeau/work/devel/yargi/lib/yargi/loader.rb" shape="parallelogram" width="1.6" height="0.4" fontname="Arial" fontsize="16" style="filled, rounded" label="loader.rb (0 kb)" fillcolor="blue4" fontcolor="white"]
22
+ V19 [file="/home/blambeau/work/devel/yargi/lib/yargi/markable.rb" shape="parallelogram" width="1.6" height="0.4" fontname="Arial" fontsize="16" style="filled, rounded" label="markable.rb (1 kb)" fillcolor="blue4" fontcolor="white"]
23
+ V20 [file="/home/blambeau/work/devel/yargi/lib/yargi/digraph_vertex.rb" shape="parallelogram" width="1.6" height="0.4" fontname="Arial" fontsize="16" style="filled, rounded" label="digraph_vertex.rb (2 kb)" fillcolor="blue4" fontcolor="white"]
24
+ V21 [file="/home/blambeau/work/devel/yargi/lib/yargi/vertex_set.rb" shape="parallelogram" width="1.6" height="0.4" fontname="Arial" fontsize="16" style="filled, rounded" label="vertex_set.rb (1 kb)" fillcolor="blue4" fontcolor="white"]
25
+ V22 [file="/home/blambeau/work/devel/yargi/lib/yargi/version.rb" shape="parallelogram" width="1.6" height="0.4" fontname="Arial" fontsize="16" style="filled, rounded" label="version.rb (0 kb)" fillcolor="blue4" fontcolor="white"]
26
+ V23 [file="/home/blambeau/work/devel/yargi/LICENCE.md" shape="box" width="1.6" height="0.4" fontname="Arial" fontsize="16" style="filled, rounded" label="LICENCE.md (1 kb)"]
27
+ V24 [file="/home/blambeau/work/devel/yargi/spec" shape="folder" width="1.6" height="0.4" fontname="Arial" fontsize="16" style="filled" fillcolor="gold" label="spec" fontcolor="black"]
28
+ V25 [file="/home/blambeau/work/devel/yargi/spec/spec_helper.rb" shape="parallelogram" width="1.6" height="0.4" fontname="Arial" fontsize="16" style="filled, rounded" label="spec_helper.rb (0 kb)" fillcolor="blue4" fontcolor="white"]
29
+ V26 [file="/home/blambeau/work/devel/yargi/spec/yargi_spec.rb" shape="parallelogram" width="1.6" height="0.4" fontname="Arial" fontsize="16" style="filled, rounded" label="yargi_spec.rb (0 kb)" fillcolor="blue4" fontcolor="white"]
30
+ V27 [file="/home/blambeau/work/devel/yargi/yargi.gemspec" shape="box" width="1.6" height="0.4" fontname="Arial" fontsize="16" style="filled, rounded" label="yargi.gemspec (6 kb)"]
31
+ V28 [file="/home/blambeau/work/devel/yargi/tasks" shape="folder" width="1.6" height="0.4" fontname="Arial" fontsize="16" style="filled" fillcolor="cornsilk2" label="tasks"]
32
+ V29 [file="/home/blambeau/work/devel/yargi/tasks/debug_mail.rake" shape="box" width="1.6" height="0.4" fontname="Arial" fontsize="16" style="filled, rounded" label="debug_mail.rake (2 kb)"]
33
+ V30 [file="/home/blambeau/work/devel/yargi/tasks/yard.rake" shape="box" width="1.6" height="0.4" fontname="Arial" fontsize="16" style="filled, rounded" label="yard.rake (1 kb)"]
34
+ V31 [file="/home/blambeau/work/devel/yargi/tasks/gem.rake" shape="box" width="1.6" height="0.4" fontname="Arial" fontsize="16" style="filled, rounded" label="gem.rake (1 kb)"]
35
+ V32 [file="/home/blambeau/work/devel/yargi/tasks/spec_test.rake" shape="box" width="1.6" height="0.4" fontname="Arial" fontsize="16" style="filled, rounded" label="spec_test.rake (2 kb)"]
36
+ V33 [file="/home/blambeau/work/devel/yargi/tasks/unit_test.rake" shape="box" width="1.6" height="0.4" fontname="Arial" fontsize="16" style="filled, rounded" label="unit_test.rake (2 kb)"]
37
+ V34 [file="/home/blambeau/work/devel/yargi/tasks/debug_mail.txt" shape="box" width="1.6" height="0.4" fontname="Arial" fontsize="16" style="filled, rounded" label="debug_mail.txt (0 kb)"]
38
+ V35 [file="/home/blambeau/work/devel/yargi/doc" shape="folder" width="1.6" height="0.4" fontname="Arial" fontsize="16" style="filled" fillcolor="white" label="doc"]
39
+ V36 [file="/home/blambeau/work/devel/yargi/Gemfile" shape="box" width="1.6" height="0.4" fontname="Arial" fontsize="16" style="filled, rounded" label="Gemfile (0 kb)"]
40
+ V37 [file="/home/blambeau/work/devel/yargi/test" shape="folder" width="1.6" height="0.4" fontname="Arial" fontsize="16" style="filled" fillcolor="white" label="test"]
41
+ V6 -> V7 []
42
+ V6 -> V8 []
43
+ V12 -> V13 []
44
+ V12 -> V14 []
45
+ V12 -> V15 []
46
+ V12 -> V16 []
47
+ V12 -> V17 []
48
+ V12 -> V18 []
49
+ V12 -> V19 []
50
+ V12 -> V20 []
51
+ V12 -> V21 []
52
+ V12 -> V22 []
53
+ V10 -> V11 []
54
+ V10 -> V12 []
55
+ V24 -> V25 []
56
+ V24 -> V26 []
57
+ V28 -> V29 []
58
+ V28 -> V30 []
59
+ V28 -> V31 []
60
+ V28 -> V32 []
61
+ V28 -> V33 []
62
+ V28 -> V34 []
41
63
  V0 -> V1 []
42
64
  V0 -> V2 []
43
65
  V0 -> V3 []
44
- V0 -> V7 []
45
- V0 -> V18 []
46
- V0 -> V19 []
47
- V0 -> V21 []
48
- V0 -> V22 []
66
+ V0 -> V4 []
67
+ V0 -> V5 []
68
+ V0 -> V6 []
69
+ V0 -> V9 []
70
+ V0 -> V10 []
49
71
  V0 -> V23 []
72
+ V0 -> V24 []
73
+ V0 -> V27 []
74
+ V0 -> V28 []
75
+ V0 -> V35 []
76
+ V0 -> V36 []
77
+ V0 -> V37 []
50
78
  }
Binary file
@@ -3,7 +3,7 @@ require 'yargi/predicate'
3
3
  module Yargi
4
4
 
5
5
  # Current Yargi version
6
- VERSION = "0.1.1".freeze
6
+ VERSION = "0.1.2".freeze
7
7
 
8
8
  # When _what_ is not nil, converts it to a predicate (typically a module).
9
9
  # Otherwise, a block is expected, which is converted to a LambdaPredicate.
@@ -40,7 +40,6 @@ module Yargi
40
40
  # Calls block on each graph vertex for with the 'filter and block' predicate
41
41
  # evaluates to true.
42
42
  def each_vertex(filter=nil, &block)
43
- return unless block_given?
44
43
  if filter.nil?
45
44
  @vertices.each &block
46
45
  else
@@ -99,7 +98,6 @@ module Yargi
99
98
  # Calls block on each graph edge for with the 'filter and block' predicate
100
99
  # evaluates to true.
101
100
  def each_edge(filter=nil, &block)
102
- return unless block_given?
103
101
  if filter.nil?
104
102
  @edges.each &block
105
103
  else
@@ -202,6 +200,16 @@ module Yargi
202
200
  buffer = ""
203
201
  hash.each_pair do |k,v|
204
202
  buffer << " " unless buffer.empty?
203
+ v = case v
204
+ when Array
205
+ if v.all?{|elm| Array===elm and elm.length==2 and elm.all?{|subelm| Numeric===subelm}}
206
+ v.inject('') {|memo, elm| "#{memo} #{elm.join(',')}"}.strip
207
+ else
208
+ v.join(', ')
209
+ end
210
+ else
211
+ v.to_s
212
+ end
205
213
  buffer << "#{k}=\"#{v}\""
206
214
  end
207
215
  buffer
@@ -25,6 +25,18 @@ module Yargi
25
25
  end
26
26
  alias :sources :source
27
27
 
28
+ ### Writing section #######################################################
29
+
30
+ # Fired to each edge in the set
31
+ def source=(source)
32
+ self.each{|e| e.source=source}
33
+ end
34
+
35
+ # Fired to each edge in the set
36
+ def target=(target)
37
+ self.each{|e| e.target=target}
38
+ end
39
+
28
40
  ### Protected section #####################################################
29
41
  protected
30
42
 
@@ -136,7 +136,7 @@ module Yargi
136
136
  if block_given?
137
137
  self.each do |elm|
138
138
  hash = yield elm
139
- elm.add_marks(hash) if hash
139
+ elm.add_marks(hash) if Hash===hash
140
140
  end
141
141
  end
142
142
  end
@@ -13,6 +13,11 @@ module Yargi
13
13
  def tag(*modules)
14
14
  modules.each {|mod| self.extend(mod)}
15
15
  end
16
+
17
+ # Checks if a given mark exists
18
+ def has_mark?(key)
19
+ @marks and @marks.has_key?(key)
20
+ end
16
21
 
17
22
  # Returns the mark value installed under _key_. Returns nil if no such mark.
18
23
  def get_mark(key)
@@ -38,8 +43,12 @@ module Yargi
38
43
  alias :[]= :set_mark
39
44
 
40
45
  # Add all marks provided by a Hash instance _marks_.
41
- def add_marks(marks)
42
- marks.each_pair {|k,v| self[k]=v}
46
+ def add_marks(marks=nil)
47
+ marks.each_pair {|k,v| self[k]=v} if marks
48
+ if block_given?
49
+ result = yield self
50
+ add_marks(result) if Hash===result
51
+ end
43
52
  end
44
53
  alias :merge_marks :add_marks
45
54
 
@@ -39,6 +39,15 @@ module Yargi
39
39
  assert_equal ifs_to_untils, @digraph.send(:to_edges, Proc.new{|e| If===e.source})
40
40
  end
41
41
 
42
+ # def test_to_dot_attributes
43
+ # hash = {:label => 'hello', :who => 'blambeau'}
44
+ # assert_equal 'label="hello" who="blambeau"', @digraph.send(:to_dot_attributes, hash)
45
+ # hash = {:label => 'hello', :style => ['filled', 'rounded']}
46
+ # assert_equal 'label="hello" style="filled, rounded"', @digraph.send(:to_dot_attributes, hash)
47
+ # hash = {:label => 'hello', :pos => [[12, 14], [15, 17]]}
48
+ # assert_equal 'label="hello" pos="12,14 15,17"', @digraph.send(:to_dot_attributes, hash)
49
+ # end
50
+
42
51
  def test_extend_returns_self_hypothese
43
52
  assert_equal self, self.extend(Until)
44
53
  end
@@ -357,4 +366,4 @@ module Yargi
357
366
  # end
358
367
 
359
368
  end
360
- end
369
+ end
@@ -0,0 +1,33 @@
1
+ require 'test/unit'
2
+ require 'yargi'
3
+
4
+ module Yargi
5
+ class EdgeSetTest < Test::Unit::TestCase
6
+
7
+ def setup
8
+ @graph = Yargi::Digraph.new
9
+ @s1, @s2 = @graph.add_n_vertices(2)
10
+ @graph.connect(@s1, @s2, {:label => 'a'})
11
+ @graph.connect(@s2, @s1, {:label => 'b'})
12
+ end
13
+
14
+ def test_source=
15
+ @graph.edges.source=@s1
16
+ assert @graph.edges.length==2
17
+ assert @s2.out_edges.empty?
18
+ assert @s2.in_edges.length==1
19
+ assert @s1.out_edges.length==2
20
+ assert @s1.in_edges.length==1
21
+ end
22
+
23
+ def test_target=
24
+ @graph.edges.target=@s1
25
+ assert @graph.edges.length==2
26
+ assert @s2.in_edges.empty?
27
+ assert @s2.out_edges.length==1
28
+ assert @s1.out_edges.length==1
29
+ assert @s1.in_edges.length==2
30
+ end
31
+
32
+ end
33
+ end
@@ -16,6 +16,12 @@ module Yargi
16
16
  assert_equal "world1", @object.get_mark("hello")
17
17
  end
18
18
 
19
+ def test_has_mark
20
+ @object.set_mark("hello", "world")
21
+ assert @object.has_mark?("hello")
22
+ assert_equal false, @object.has_mark?("hello1")
23
+ end
24
+
19
25
  def test_mark_set_and_get_though_hash_api
20
26
  @object["hello"] = "world"
21
27
  assert_equal "world", @object["hello"]
@@ -41,6 +47,30 @@ module Yargi
41
47
  assert_equal "marks", @object["hello"]
42
48
  end
43
49
 
50
+ def test_add_marks
51
+ @object.add_marks(:hello => 'world', :priority => 1.0)
52
+ assert_equal 'world', @object[:hello]
53
+ assert_equal 1.0, @object[:priority]
54
+ end
55
+
56
+ def test_add_marks_with_block
57
+ @object.add_marks do |v|
58
+ {:hello => 'world', :priority => 1.0, :debug => v.to_s}
59
+ end
60
+ assert_equal 'world', @object[:hello]
61
+ assert_equal 1.0, @object[:priority]
62
+ assert_not_nil @object[:debug]
63
+ end
64
+
65
+ def test_add_marks_with_both
66
+ @object.add_marks(:hello => 'world') do |v|
67
+ {:priority => 1.0, :debug => v.to_s}
68
+ end
69
+ assert_equal 'world', @object[:hello]
70
+ assert_equal 1.0, @object[:priority]
71
+ assert_not_nil @object[:debug]
72
+ end
73
+
44
74
  def test_to_h
45
75
  @object.set_mark(:me, "blambeau")
46
76
  @object.add_marks(:hello => "world", :who => "yarvi", :nil => nil)
Binary file
metadata CHANGED
@@ -1,90 +1,82 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: yargi
3
- version: !ruby/object:Gem::Version
4
- version: 0.1.1
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.2
5
+ prerelease:
5
6
  platform: ruby
6
- authors:
7
+ authors:
7
8
  - Bernard Lambeau
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
-
12
- date: 2009-03-20 00:00:00 +01:00
13
- default_executable:
12
+ date: 2011-07-19 00:00:00.000000000Z
14
13
  dependencies: []
15
-
16
14
  description: Mutable graphs made easy.
17
15
  email: blambeau@gmail.com
18
16
  executables: []
19
-
20
17
  extensions: []
21
-
22
- extra_rdoc_files:
18
+ extra_rdoc_files:
23
19
  - README
24
20
  - LICENCE
25
21
  - CONTRIBUTE
26
- files:
27
- - lib/yargi
28
- - lib/yargi/digraph.rb
22
+ files:
23
+ - lib/yargi.rb
24
+ - lib/yargi/element_set.rb
25
+ - lib/yargi/predicate.rb
29
26
  - lib/yargi/digraph_edge.rb
30
- - lib/yargi/digraph_vertex.rb
27
+ - lib/yargi/digraph.rb
31
28
  - lib/yargi/edge_set.rb
32
- - lib/yargi/element_set.rb
33
29
  - lib/yargi/markable.rb
34
- - lib/yargi/predicate.rb
30
+ - lib/yargi/digraph_vertex.rb
35
31
  - lib/yargi/vertex_set.rb
36
- - lib/yargi.rb
37
32
  - test/test_all.rb
38
- - test/yargi
39
- - test/yargi/digraph_set_features_test.rb
33
+ - test/yargi/markable_test.rb
40
34
  - test/yargi/digraph_test.rb
41
- - test/yargi/digraph_vertex_test.rb
42
- - test/yargi/documentation_test.rb
43
- - test/yargi/element_set_test.rb
35
+ - test/yargi/vertex_set_test.rb
44
36
  - test/yargi/hypotheses_test.rb
45
- - test/yargi/markable_test.rb
46
- - test/yargi/predicate_test.rb
47
- - test/yargi/README-example.dot
37
+ - test/yargi/element_set_test.rb
48
38
  - test/yargi/README-example.gif
49
- - test/yargi/source-sink.dot
39
+ - test/yargi/digraph_vertex_test.rb
40
+ - test/yargi/README-example.dot
50
41
  - test/yargi/source-sink.gif
51
- - test/yargi/star.dot
52
- - test/yargi/vertex_set_test.rb
53
- - examples/fs2dot.dot
42
+ - test/yargi/documentation_test.rb
43
+ - test/yargi/source-sink.dot
44
+ - test/yargi/edge_set_test.rb
45
+ - test/yargi/predicate_test.rb
46
+ - test/yargi/digraph_set_features_test.rb
54
47
  - examples/fs2dot.gif
48
+ - examples/fs2dot.dot
55
49
  - examples/fs2dot.rb
56
50
  - README
57
51
  - LICENCE
58
52
  - CONTRIBUTE
59
- has_rdoc: true
60
53
  homepage: https://code.chefbe.net/
54
+ licenses: []
61
55
  post_install_message:
62
- rdoc_options:
56
+ rdoc_options:
63
57
  - --title
64
58
  - Yargi - Yet Another Ruby Graph Implementation
65
59
  - --main
66
60
  - README
67
61
  - --line-numbers
68
- require_paths:
62
+ require_paths:
69
63
  - lib
70
- required_ruby_version: !ruby/object:Gem::Requirement
71
- requirements:
72
- - - ">="
73
- - !ruby/object:Gem::Version
74
- version: "0"
75
- version:
76
- required_rubygems_version: !ruby/object:Gem::Requirement
77
- requirements:
78
- - - ">="
79
- - !ruby/object:Gem::Version
80
- version: "0"
81
- version:
64
+ required_ruby_version: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ required_rubygems_version: !ruby/object:Gem::Requirement
71
+ none: false
72
+ requirements:
73
+ - - ! '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
82
76
  requirements: []
83
-
84
77
  rubyforge_project:
85
- rubygems_version: 1.3.1
78
+ rubygems_version: 1.8.5
86
79
  signing_key:
87
- specification_version: 2
80
+ specification_version: 3
88
81
  summary: Yet Another Ruby Graph Implementation
89
82
  test_files: []
90
-
@@ -1,144 +0,0 @@
1
- digraph G {
2
- graph[]
3
- V0 []
4
- V1 []
5
- V2 []
6
- V3 []
7
- V4 []
8
- V5 []
9
- V6 []
10
- V7 []
11
- V8 []
12
- V9 []
13
- V10 []
14
- V11 []
15
- V12 []
16
- V13 []
17
- V14 []
18
- V15 []
19
- V16 []
20
- V17 []
21
- V18 []
22
- V19 []
23
- V20 []
24
- V0 -> V1 []
25
- V0 -> V2 []
26
- V0 -> V3 []
27
- V0 -> V4 []
28
- V0 -> V5 []
29
- V0 -> V6 []
30
- V0 -> V7 []
31
- V0 -> V8 []
32
- V0 -> V9 []
33
- V0 -> V10 []
34
- V1 -> V11 []
35
- V2 -> V12 []
36
- V3 -> V13 []
37
- V4 -> V14 []
38
- V5 -> V15 []
39
- V6 -> V16 []
40
- V7 -> V17 []
41
- V8 -> V18 []
42
- V9 -> V19 []
43
- V10 -> V20 []
44
- V1 -> V1 []
45
- V1 -> V2 []
46
- V1 -> V3 []
47
- V1 -> V4 []
48
- V1 -> V5 []
49
- V1 -> V6 []
50
- V1 -> V7 []
51
- V1 -> V8 []
52
- V1 -> V9 []
53
- V1 -> V10 []
54
- V2 -> V1 []
55
- V2 -> V2 []
56
- V2 -> V3 []
57
- V2 -> V4 []
58
- V2 -> V5 []
59
- V2 -> V6 []
60
- V2 -> V7 []
61
- V2 -> V8 []
62
- V2 -> V9 []
63
- V2 -> V10 []
64
- V3 -> V1 []
65
- V3 -> V2 []
66
- V3 -> V3 []
67
- V3 -> V4 []
68
- V3 -> V5 []
69
- V3 -> V6 []
70
- V3 -> V7 []
71
- V3 -> V8 []
72
- V3 -> V9 []
73
- V3 -> V10 []
74
- V4 -> V1 []
75
- V4 -> V2 []
76
- V4 -> V3 []
77
- V4 -> V4 []
78
- V4 -> V5 []
79
- V4 -> V6 []
80
- V4 -> V7 []
81
- V4 -> V8 []
82
- V4 -> V9 []
83
- V4 -> V10 []
84
- V5 -> V1 []
85
- V5 -> V2 []
86
- V5 -> V3 []
87
- V5 -> V4 []
88
- V5 -> V5 []
89
- V5 -> V6 []
90
- V5 -> V7 []
91
- V5 -> V8 []
92
- V5 -> V9 []
93
- V5 -> V10 []
94
- V6 -> V1 []
95
- V6 -> V2 []
96
- V6 -> V3 []
97
- V6 -> V4 []
98
- V6 -> V5 []
99
- V6 -> V6 []
100
- V6 -> V7 []
101
- V6 -> V8 []
102
- V6 -> V9 []
103
- V6 -> V10 []
104
- V7 -> V1 []
105
- V7 -> V2 []
106
- V7 -> V3 []
107
- V7 -> V4 []
108
- V7 -> V5 []
109
- V7 -> V6 []
110
- V7 -> V7 []
111
- V7 -> V8 []
112
- V7 -> V9 []
113
- V7 -> V10 []
114
- V8 -> V1 []
115
- V8 -> V2 []
116
- V8 -> V3 []
117
- V8 -> V4 []
118
- V8 -> V5 []
119
- V8 -> V6 []
120
- V8 -> V7 []
121
- V8 -> V8 []
122
- V8 -> V9 []
123
- V8 -> V10 []
124
- V9 -> V1 []
125
- V9 -> V2 []
126
- V9 -> V3 []
127
- V9 -> V4 []
128
- V9 -> V5 []
129
- V9 -> V6 []
130
- V9 -> V7 []
131
- V9 -> V8 []
132
- V9 -> V9 []
133
- V9 -> V10 []
134
- V10 -> V1 []
135
- V10 -> V2 []
136
- V10 -> V3 []
137
- V10 -> V4 []
138
- V10 -> V5 []
139
- V10 -> V6 []
140
- V10 -> V7 []
141
- V10 -> V8 []
142
- V10 -> V9 []
143
- V10 -> V10 []
144
- }