ast2dot 0.1.0 → 0.1.1

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
  SHA256:
3
- metadata.gz: 1c78fa3f2f4b88e7a46dbd9b2ef7b1920cfdd3aabc27f73ac590a230f15de023
4
- data.tar.gz: 884607eebf4566717ff294773701bd97f4eceeedbfa3cad17a6529ecad40b1fe
3
+ metadata.gz: cf8d695148fcbe02fdec4e0d52ade43c1c85107b5ff792972772b6ba19ea4f3e
4
+ data.tar.gz: 9d05e0a1ceb775cabaa61ffd95bb26fdc51972f9543777b04993df2fdd2cc001
5
5
  SHA512:
6
- metadata.gz: b7a0369fa11d8f5f18f600fc682166fdf0749bca95d35cea88a90cef0f80c5f9cf5cfad70705f072d28d253dc860f4a94f7f1a975ea86cb7079f3f6217dcd6d6
7
- data.tar.gz: ad2e4a93ea93a4c3cf0f53bc8aa3ae752928dc00edc92219996c69565140154e547562ef0824627e07baefe95ba2d475b64fea755134be6a1ed314f0dda75a61
6
+ metadata.gz: 3c7768f77e58bf2bf64648fdda43ca6bd371d8d6121fa76c5f651e5b396abef4ed881fc06780b04f513e530c821cdde07a79ed228fee8fc8d9d3e9e7d7951999
7
+ data.tar.gz: 4e752fc18fbdeef3ba1d9b9a9ada0ac546d9cc6caaaff94096046a69ce1478da9049189fdc0b371d916a30aae968cd3048c8f21d4d105f0ac7fe425ff0ec7983
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ast2dot (0.1.0)
4
+ ast2dot (0.1.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
12
12
  spec.description = %q{AbstractSyntaxTree to Dot file.}
13
13
  spec.homepage = 'https://github.com/siman-man/ast2dot'
14
14
  spec.license = 'MIT'
15
- spec.required_ruby_version = '>= 2.6.0'
15
+ spec.required_ruby_version = '>= 2.6.1'
16
16
 
17
17
  # Specify which files should be added to the gem when it is released.
18
18
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
@@ -1,4 +1,5 @@
1
1
  require 'ast2dot/version'
2
+ require 'ast2dot/node_label'
2
3
  require 'erb'
3
4
 
4
5
  class AST2Dot
@@ -0,0 +1,16 @@
1
+ class AST2Dot
2
+ class NodeLabel
3
+ def self.label(node)
4
+ case node.type
5
+ when :FCALL
6
+ "%s\\nmethod_id: %p" % [node.type, node.children[0]]
7
+ when :OPCALL
8
+ "%s\\nmethod_id: %p" % [node.type, node.children[1]]
9
+ when :LIT
10
+ "%s\\nvalue: %p" % [node.type, node.children[0]]
11
+ else
12
+ node.type
13
+ end
14
+ end
15
+ end
16
+ end
@@ -1,3 +1,3 @@
1
1
  class AST2Dot
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
@@ -1,5 +1,12 @@
1
1
  digraph ast_graph {
2
2
  graph [ dpi = 200 ];
3
+
4
+ node [
5
+ fontsize = 14,
6
+ shape = box,
7
+ style = "bold,rounded",
8
+ margin = 0.2
9
+ ];
3
10
  <%- node_labels.each do |idx, label| %>
4
11
  <%= %Q(#{idx} [label="#{label}"];); -%>
5
12
  <% end %>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ast2dot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shuichi Tamayose
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-03-05 00:00:00.000000000 Z
11
+ date: 2019-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -75,6 +75,7 @@ files:
75
75
  - exe/ast2dot
76
76
  - images/example.png
77
77
  - lib/ast2dot.rb
78
+ - lib/ast2dot/node_label.rb
78
79
  - lib/ast2dot/version.rb
79
80
  - lib/templates/default.dot.erb
80
81
  homepage: https://github.com/siman-man/ast2dot
@@ -89,7 +90,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
89
90
  requirements:
90
91
  - - ">="
91
92
  - !ruby/object:Gem::Version
92
- version: 2.6.0
93
+ version: 2.6.1
93
94
  required_rubygems_version: !ruby/object:Gem::Requirement
94
95
  requirements:
95
96
  - - ">="