constree 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/constree.gemspec +1 -1
- data/lib/constree.rb +2 -3
- data/lib/constree/node.rb +5 -10
- data/lib/constree/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b4aa8167f394c7265f6325354ec3a8dfed64638
|
4
|
+
data.tar.gz: 0a005655a766ab96486bb4d4166f5db39e74747c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ca3134b3db7cc7a179e6b076bcdce01ae1b102151a47e9985cc66e4aaea0b343fb875e8e0ce636091b0bf7e005310a7402c29bc83dc1712a01a435ef0062729
|
7
|
+
data.tar.gz: c6624630d6bdecf2b78c80ce427e9cb76fe4d50b1c28cce71750a9b8e1771f5c687e0a38fe812dd4c98cf5043db31e620ac40bded681cc0a44753525b3802157
|
data/constree.gemspec
CHANGED
@@ -24,5 +24,5 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_development_dependency "rake", "~> 10.0"
|
25
25
|
spec.add_development_dependency "minitest", "~> 5.0"
|
26
26
|
|
27
|
-
spec.add_development_dependency "tree_graph", "~> 0.
|
27
|
+
spec.add_development_dependency "tree_graph", "~> 0.2.0"
|
28
28
|
end
|
data/lib/constree.rb
CHANGED
@@ -11,6 +11,7 @@ module Constree
|
|
11
11
|
|
12
12
|
node.sub_nodes.each do |sub_n|
|
13
13
|
seen << sub_n
|
14
|
+
node.children_for_tree_graph << sub_n
|
14
15
|
list(sub_n, seen) if sub_n.not_yet? seen
|
15
16
|
end
|
16
17
|
|
@@ -18,9 +19,7 @@ module Constree
|
|
18
19
|
end
|
19
20
|
|
20
21
|
def of mod
|
21
|
-
list(mod).
|
22
|
-
map(&:tree_graph_level).
|
23
|
-
join("\n")
|
22
|
+
list(mod).first.tree_graph
|
24
23
|
end
|
25
24
|
|
26
25
|
def p mod
|
data/lib/constree/node.rb
CHANGED
@@ -1,29 +1,24 @@
|
|
1
1
|
require 'tree_graph'
|
2
2
|
|
3
3
|
module Constree
|
4
|
-
Node = Struct.new :constant, :name, :parent
|
4
|
+
Node = Struct.new :constant, :name, :parent do
|
5
5
|
|
6
6
|
include TreeGraph
|
7
7
|
|
8
|
-
def parent_for_tree_graph
|
9
|
-
parent
|
10
|
-
end
|
11
|
-
|
12
8
|
def label_for_tree_graph
|
13
9
|
display_name + ' ' + type
|
14
10
|
end
|
15
11
|
|
16
|
-
def
|
17
|
-
|
12
|
+
def children_for_tree_graph
|
13
|
+
@sub_consts ||= []
|
18
14
|
end
|
19
15
|
|
20
16
|
attr_accessor :ref
|
21
17
|
|
22
18
|
def sub_nodes
|
23
19
|
return [] unless constant.is_a? Module
|
24
|
-
|
25
|
-
|
26
|
-
nodes << Node.new(constant.const_get(name), name, self, nodes.count == names.count - 1)
|
20
|
+
constant.constants.map do |name|
|
21
|
+
Node.new(constant.const_get(name), name, self)
|
27
22
|
end
|
28
23
|
end
|
29
24
|
|
data/lib/constree/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: constree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ken
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02-
|
11
|
+
date: 2017-02-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -58,14 +58,14 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.
|
61
|
+
version: 0.2.0
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.
|
68
|
+
version: 0.2.0
|
69
69
|
description:
|
70
70
|
email:
|
71
71
|
- block24block@gmail.com
|
@@ -107,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
107
|
version: '0'
|
108
108
|
requirements: []
|
109
109
|
rubyforge_project:
|
110
|
-
rubygems_version: 2.
|
110
|
+
rubygems_version: 2.4.8
|
111
111
|
signing_key:
|
112
112
|
specification_version: 4
|
113
113
|
summary: recursively show the structure of constants in a module
|