dissociated_introspection 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -2
- data/lib/dissociated_introspection/ruby_class.rb +27 -3
- data/lib/dissociated_introspection/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b87f194e1bad12f5d03f1607361fcf64d08bcfb7
|
4
|
+
data.tar.gz: 5f59172b7b25e8fbc90a606dd6cb25a4ecf2e23b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1e3f2b1e0c139c30a6c11d6488f23b272bdd47e7d73ddee922e8a59bf92c70d995979a7942f906ca923afca83f7652c29475aa939d746258106e0cca1457778
|
7
|
+
data.tar.gz: 2756ad073c45e86e3c61eb1a13f82f2eb7a14003fb30bd723a4047ae16e5f0aa87ecae6427b808352eb23bf08905b2c2eaa0a3c3aaf7072744191fef692476ba
|
data/.travis.yml
CHANGED
@@ -39,7 +39,7 @@ module DissociatedIntrospection
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def has_parent_class?
|
42
|
-
return false
|
42
|
+
return false unless find_class
|
43
43
|
find_class.to_a[1].try(:type) == :const
|
44
44
|
end
|
45
45
|
|
@@ -81,6 +81,19 @@ module DissociatedIntrospection
|
|
81
81
|
comments: comments)
|
82
82
|
end
|
83
83
|
|
84
|
+
def module_nesting
|
85
|
+
ary = []
|
86
|
+
m = ast
|
87
|
+
while m
|
88
|
+
if (m = depth_first_search(m, :module))
|
89
|
+
name = m.to_a[0].to_a[1]
|
90
|
+
ary << name unless name.nil?
|
91
|
+
m = m.to_a[1]
|
92
|
+
end
|
93
|
+
end
|
94
|
+
ary
|
95
|
+
end
|
96
|
+
|
84
97
|
private
|
85
98
|
|
86
99
|
def scrub_inner_classes_ast
|
@@ -90,8 +103,19 @@ module DissociatedIntrospection
|
|
90
103
|
end
|
91
104
|
|
92
105
|
def find_class
|
93
|
-
|
94
|
-
|
106
|
+
depth_first_search(ast, :class)
|
107
|
+
end
|
108
|
+
|
109
|
+
def depth_first_search(node, target)
|
110
|
+
return false unless node.is_a?(Parser::AST::Node)
|
111
|
+
return node if node.type == target
|
112
|
+
if (children = node.children)
|
113
|
+
children.each do |kid|
|
114
|
+
v = depth_first_search(kid, target)
|
115
|
+
return v if v.is_a?(Parser::AST::Node)
|
116
|
+
end
|
117
|
+
end
|
118
|
+
return false
|
95
119
|
end
|
96
120
|
|
97
121
|
def nodes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dissociated_introspection
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dustin Zeisler
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: parser
|