constree 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 +4 -4
- data/README.md +10 -10
- data/constree.gemspec +2 -0
- data/lib/constree.rb +1 -1
- data/lib/constree/node.rb +16 -33
- data/lib/constree/version.rb +1 -1
- metadata +17 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b101ec84610a6f7d3e988fb320773c4c3d15a3b
|
4
|
+
data.tar.gz: 3a4e13a59be613d33799afdb8548cc3bd008fde8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 951f0e0c1fd79a543a4f70a9c55e737650d2fc6709329ae94e0c1550568538f3cbfb9bc37c738e03b37f6254adf88bfbe25f3271c454b5ca745604ababda1661
|
7
|
+
data.tar.gz: 2439cff5df3410d9f6f3594a3bb48c0c70089d3b269b0e44837664032e4f66123d7a748aa766503cc0a5073af8c2c2175f4f285d51cd1b42e53523b90f6bd5a5
|
data/README.md
CHANGED
@@ -27,16 +27,16 @@ Or install it yourself as:
|
|
27
27
|
=> true
|
28
28
|
2.2.2 :003 > Minitest::Spec.constreep
|
29
29
|
Minitest::Spec (Class)
|
30
|
-
DSL (Module)
|
31
|
-
TYPES (Array)
|
32
|
-
InstanceMethods (Module)
|
33
|
-
TYPES
|
34
|
-
PASSTHROUGH_EXCEPTIONS (Array)
|
35
|
-
TEARDOWN_METHODS (Array)
|
36
|
-
LifecycleHooks (Module)
|
37
|
-
UNDEFINED (Object)
|
38
|
-
E (String)
|
39
|
-
SIGNALS (Hash)
|
30
|
+
├─DSL (Module)
|
31
|
+
│ ├─TYPES (Array)
|
32
|
+
│ └─InstanceMethods (Module)
|
33
|
+
├─TYPES → Minitest::Spec::DSL::TYPES
|
34
|
+
├─PASSTHROUGH_EXCEPTIONS (Array)
|
35
|
+
├─TEARDOWN_METHODS (Array)
|
36
|
+
├─LifecycleHooks (Module)
|
37
|
+
├─UNDEFINED (Object)
|
38
|
+
├─E (String)
|
39
|
+
└─SIGNALS (Hash)
|
40
40
|
=> nil
|
41
41
|
```
|
42
42
|
|
data/constree.gemspec
CHANGED
data/lib/constree.rb
CHANGED
data/lib/constree/node.rb
CHANGED
@@ -1,6 +1,22 @@
|
|
1
|
+
require 'tree_graph'
|
2
|
+
|
1
3
|
module Constree
|
2
4
|
Node = Struct.new :constant, :name, :parent, :is_last do
|
3
5
|
|
6
|
+
include TreeGraph
|
7
|
+
|
8
|
+
def parent_for_tree_graph
|
9
|
+
parent
|
10
|
+
end
|
11
|
+
|
12
|
+
def label_for_tree_graph
|
13
|
+
display_name + ' ' + type
|
14
|
+
end
|
15
|
+
|
16
|
+
def is_last_for_tree_graph
|
17
|
+
is_last ? true : false
|
18
|
+
end
|
19
|
+
|
4
20
|
attr_accessor :ref
|
5
21
|
|
6
22
|
def sub_nodes
|
@@ -11,43 +27,10 @@ module Constree
|
|
11
27
|
end
|
12
28
|
end
|
13
29
|
|
14
|
-
def ancestors
|
15
|
-
return [] unless parent
|
16
|
-
p, anc = parent, []
|
17
|
-
while p
|
18
|
-
anc.unshift p
|
19
|
-
p = p.parent
|
20
|
-
end
|
21
|
-
anc
|
22
|
-
end
|
23
|
-
|
24
|
-
def last?
|
25
|
-
is_last ? true : false
|
26
|
-
end
|
27
|
-
|
28
30
|
def top?
|
29
31
|
parent ? false : true
|
30
32
|
end
|
31
33
|
|
32
|
-
def branch
|
33
|
-
return '' unless parent
|
34
|
-
last? ? '└─' : '├─'
|
35
|
-
end
|
36
|
-
|
37
|
-
def indent
|
38
|
-
ancestors.map do |a|
|
39
|
-
if a.top?
|
40
|
-
''
|
41
|
-
else
|
42
|
-
a.last? ? ' ' : '│ '
|
43
|
-
end
|
44
|
-
end.join
|
45
|
-
end
|
46
|
-
|
47
|
-
def level
|
48
|
-
indent + branch + display_name + ' ' + type
|
49
|
-
end
|
50
|
-
|
51
34
|
def display_name
|
52
35
|
(name || constant.name).to_s
|
53
36
|
end
|
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.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ken
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '5.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: tree_graph
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.1.0
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.1.0
|
55
69
|
description:
|
56
70
|
email:
|
57
71
|
- block24block@gmail.com
|
@@ -93,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
93
107
|
version: '0'
|
94
108
|
requirements: []
|
95
109
|
rubyforge_project:
|
96
|
-
rubygems_version: 2.
|
110
|
+
rubygems_version: 2.5.2
|
97
111
|
signing_key:
|
98
112
|
specification_version: 4
|
99
113
|
summary: recursively show the structure of constants in a module
|