constree 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +10 -2
- data/constree.gemspec +1 -0
- data/lib/constree/node.rb +14 -0
- data/lib/constree/version.rb +1 -1
- data/lib/constree.rb +4 -0
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fda87378a074ec894ad39ea09eff44fe458f6ea5ad208b9a53ff097a07c2d8b8
|
4
|
+
data.tar.gz: e2b0d100fdfac4da1ab1eedec5eb1efc98383de15a55a67aa642a34601505d7c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 833f161b42abd52f8193281c0236b19b5b72edfe8738a28e73861611ab15cdab1733846b4d70fc625dc14b32100ca17085021a4c7298f9a6904881e34ee39622
|
7
|
+
data.tar.gz: b6558cc98fc60be4e1e6c0701abc56cfdabe8c549b89f7f96938aa238caa0849618945061a7fce1270e2799d5b0b278f717592d7c72eaff8e5b99f8cfa8ae58e
|
data/README.md
CHANGED
@@ -18,12 +18,20 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
$ gem install constree
|
20
20
|
|
21
|
-
## Example:
|
21
|
+
## Example: output tree to html
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
File.open('somewhere', 'w') do |f|
|
25
|
+
f.puts Constree.html_of SomeConstant
|
26
|
+
end
|
27
|
+
```
|
28
|
+
|
29
|
+
## Example: check constants in concurrent-ruby, in irb console
|
22
30
|
|
23
31
|
```ruby
|
24
32
|
irb(main):001:0> require "concurrent-ruby"
|
25
33
|
=> true
|
26
|
-
irb(main):002:0> Constree.p
|
34
|
+
irb(main):002:0> Constree.p Concurrent
|
27
35
|
Concurrent {:kla=>Module}
|
28
36
|
├─AbstractExchanger {:kla=>Class, :aft=>[Concurrent::Synchronization::Object, Concurrent::Synchronization::MriObject, Concurrent::Synchronization::MriAttrVolatile, Concurrent::Synchronization::AbstractObject, Object, Kernel, BasicObject]}
|
29
37
|
│ └─ClassMethods {:kla=>Module}
|
data/constree.gemspec
CHANGED
data/lib/constree/node.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'tree_graph'
|
2
|
+
require 'tree_html'
|
2
3
|
|
3
4
|
module Constree
|
4
5
|
Node = Struct.new :constant, :name, :parent do
|
@@ -13,6 +14,18 @@ module Constree
|
|
13
14
|
@sub_consts ||= []
|
14
15
|
end
|
15
16
|
|
17
|
+
include TreeHtml
|
18
|
+
|
19
|
+
def label_for_tree_html
|
20
|
+
"<span class='hl'>#{display_name}</span> #{verbose}"
|
21
|
+
end
|
22
|
+
|
23
|
+
alias_method :children_for_tree_html, :children_for_tree_graph
|
24
|
+
|
25
|
+
def css_for_tree_html
|
26
|
+
'.hl{color: coral;}'
|
27
|
+
end
|
28
|
+
|
16
29
|
attr_accessor :ref
|
17
30
|
|
18
31
|
def sub_nodes
|
@@ -36,6 +49,7 @@ module Constree
|
|
36
49
|
end
|
37
50
|
|
38
51
|
def == other
|
52
|
+
return false unless constant.is_a? Module
|
39
53
|
return false unless other.is_a? Node
|
40
54
|
constant == other.constant
|
41
55
|
end
|
data/lib/constree/version.rb
CHANGED
data/lib/constree.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ken
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 0.2.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: tree_html
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.1.10
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.1.10
|
69
83
|
description:
|
70
84
|
email:
|
71
85
|
- block24block@gmail.com
|