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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fd2b780d56b1776a610fc399ffbbc161843146f3
4
- data.tar.gz: dae4b75255c0105ab09a46b39286a862f5766dcb
3
+ metadata.gz: 1b101ec84610a6f7d3e988fb320773c4c3d15a3b
4
+ data.tar.gz: 3a4e13a59be613d33799afdb8548cc3bd008fde8
5
5
  SHA512:
6
- metadata.gz: bc5445f233c122acbb4db2ca7123adcd3d9825245a7010f4f4f065f39766b28cc45b5f340c03c5eac936572a61d2252cfb825fa36296821ba8cec56b6a882b07
7
- data.tar.gz: db1d5c3861311b7a473b2ce528d67bb8293d9af9eb554b943e7ce6a37b0277d39109c78e706aa5764b1e223790eb4ddde009f76577875f9bc76e24193dd7d119
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 Minitest::Spec::DSL::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
+ ├─TYPESMinitest::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
 
@@ -23,4 +23,6 @@ Gem::Specification.new do |spec|
23
23
  spec.add_development_dependency "bundler", "~> 1.13"
24
24
  spec.add_development_dependency "rake", "~> 10.0"
25
25
  spec.add_development_dependency "minitest", "~> 5.0"
26
+
27
+ spec.add_development_dependency "tree_graph", "0.1.0"
26
28
  end
@@ -19,7 +19,7 @@ module Constree
19
19
 
20
20
  def of mod
21
21
  list(mod).
22
- map(&:level).
22
+ map(&:tree_graph_level).
23
23
  join("\n")
24
24
  end
25
25
 
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Constree
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
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.0
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-01-21 00:00:00.000000000 Z
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.4.8
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