razyk 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b43dc862740e8a544e5b5de87429f8542a1e3896
4
- data.tar.gz: 9803423368fa9012c5a24e02d710803e3f21c76e
3
+ metadata.gz: 5d5ba372cdd5642d7a153cccec2a815ebe8e08f1
4
+ data.tar.gz: 831ddd5767b9d3c86d096f1a710b1ed45f2d7fcb
5
5
  SHA512:
6
- metadata.gz: 91b9e435c3355541eddfb327839f92e7aecf6a55f38c12bcfd12fba75a9080a7bbc204ab3ea8e23eb1c5862634d48d8efb0d53103962337286eac83bb3a8b32b
7
- data.tar.gz: 357f1518a1717c1d98731838ea7e95512911e2a2d6413fc9660e20719a7689ee43a8646da49874d4d6a737afcafdd8d7f682e4d25bc54dbbb269ca9be775fb98
6
+ metadata.gz: 9047eaaff4ddce70112f82e8e389f0bc5d5345f5530808f83e30f59bb3b90e0cdd51b98579ec851bcfb62317022044fbcd4b55bbeb26e3b43724f00b466b0944
7
+ data.tar.gz: 9593a02a185b571010313f396937f4e94509fdb52c48927fa384e11d46b89bf5065a1b4d9f9495b48a625e84334e2450c8d09ba2e498ad5bec43aa1468ce0751
@@ -1,9 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- razyk (0.1.0)
4
+ razyk (0.2.0)
5
5
  rack
6
- ruby-graphviz
7
6
 
8
7
  GEM
9
8
  remote: https://rubygems.org/
@@ -23,7 +22,6 @@ GEM
23
22
  racc (1.4.13)
24
23
  rack (1.6.4)
25
24
  rake (10.4.2)
26
- ruby-graphviz (1.2.2)
27
25
  simplecov (0.10.0)
28
26
  docile (~> 1.1.0)
29
27
  json (~> 1.8)
@@ -1,3 +1,3 @@
1
1
  module RazyK
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -23,7 +23,6 @@ Gem::Specification.new do |s|
23
23
 
24
24
  s.required_ruby_version = ">= 2.0.0"
25
25
 
26
- s.add_runtime_dependency "ruby-graphviz"
27
26
  s.add_runtime_dependency "rack"
28
27
 
29
28
  s.add_development_dependency "bundler", "~> 1.10"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: razyk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - nagachika
@@ -10,20 +10,6 @@ bindir: bin
10
10
  cert_chain: []
11
11
  date: 2015-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: ruby-graphviz
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: rack
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -171,7 +157,6 @@ files:
171
157
  - lib/razyk/audio.rb
172
158
  - lib/razyk/audio/player.rb
173
159
  - lib/razyk/audio/port.rb
174
- - lib/razyk/graph.rb
175
160
  - lib/razyk/node.rb
176
161
  - lib/razyk/parser.rb
177
162
  - lib/razyk/parser.y
@@ -1,66 +0,0 @@
1
- require "razyk/node"
2
-
3
- begin
4
- require "graphviz"
5
- rescue LoadError
6
- end
7
-
8
- if defined?(GraphViz)
9
- module RazyK
10
- module Graph
11
- def create_node(gv, tree, ctx)
12
- i = ctx[:index]
13
- ctx[:index] = i + 1
14
- if tree.to.empty?
15
- gv.add_node("#{tree.label}#{i}", :label => tree.label.to_s)
16
- else
17
- gv.add_node("#{tree.label}#{i}", :shape => "point")
18
- end
19
- end
20
- module_function :create_node
21
-
22
- def graph_internal(gv, tree, node, ctx)
23
- tree.to.each do |n|
24
- cached = false
25
- if ctx[:cache] and ctx[:cache][n.object_id]
26
- gn = ctx[:cache][n.object_id]
27
- cached = true
28
- else
29
- gn = create_node(gv, n, ctx)
30
- ctx[:cache][n.object_id] = gn
31
- end
32
- if tree.car == n
33
- gv.add_edge(node, gn, :color => ctx[:car_arrow_color])
34
- else
35
- gv.add_edge(node, gn, :color => ctx[:cdr_arrow_color])
36
- end
37
- unless cached
38
- graph_internal(gv, n, gn, ctx)
39
- end
40
- end
41
- end
42
- module_function :graph_internal
43
-
44
- #
45
- # create GraphViz from combinator tree
46
- #
47
- def graph(tree, opt={})
48
- gv = GraphViz.new("CombinatorGraph")
49
- ctx = {
50
- :index => 0,
51
- :car_arrow_color => opt[:car_arrow_color] || :red,
52
- :cdr_arrow_color => opt[:cdr_arrow_color] || :black,
53
- :cache => (opt[:style] == :dag) ? {} : nil,
54
- }
55
- node = create_node(gv, tree, ctx)
56
- graph_internal(gv, tree, node, ctx)
57
- gv
58
- end
59
- module_function :graph
60
-
61
- def tree2svg(tree, file=nil)
62
- graph(tree).output(:svg => file)
63
- end
64
- end
65
- end
66
- end