drg 0.15.1 → 0.15.2
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/lib/drg/ruby/const.rb +9 -2
- data/lib/drg/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f1910c0f8c2bc805658481b0fe924c81178d6523
|
4
|
+
data.tar.gz: 59a3de60bfcfa792a81cad5b23ba77cf569c259c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e92fdb899f3ad0beba37ed43de71a7da699aaa0eb58496057f7632a1d3c1631479cac601f36a90423e61856e1ff30aa9e468d577ca0ef5699995b3b3cfb2449b
|
7
|
+
data.tar.gz: 46c3e353e3a89151609f7621e92b7cdd07a5ff89897f10d5e75b26cc360c133b4c07222d8c22f40db3ff5d75019ff74da52e79d5b2945d80174dafe843d90966
|
data/lib/drg/ruby/const.rb
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
require 'ruby_parser'
|
2
2
|
|
3
3
|
class DRG::Ruby::Const
|
4
|
-
|
4
|
+
CLASS_MOD_DEFS = { class: :class, module: :module }
|
5
|
+
CONSTANT_DEFS = { cdecl: :class }.merge CLASS_MOD_DEFS
|
5
6
|
|
6
7
|
attr_reader :sexp
|
7
8
|
|
@@ -11,13 +12,19 @@ class DRG::Ruby::Const
|
|
11
12
|
@sexp = sexp
|
12
13
|
end
|
13
14
|
|
15
|
+
# s(:module, :Admin, s(:class, :Super, nil, s(:class, :UsersController, s(:colon3, :ApplicationController), s(:defn, :name, s(:args)
|
16
|
+
# s(:class, :Report, nil, s(:cdecl, :DEFAULT_TZ, s(:str, "UTC")), s(:defs, s(:self), :enqueue,
|
14
17
|
def name(sexp = @sexp, list = [])
|
15
18
|
sexp = Array(sexp)
|
16
19
|
if sexp[1].is_a?(Sexp) && sexp[1][0] == :colon2
|
17
20
|
parts = sexp[1].to_a.flatten
|
18
21
|
list.concat parts.drop(parts.size / 2)
|
19
22
|
elsif CONSTANT_DEFS.key?(sexp[0])
|
20
|
-
|
23
|
+
list << sexp[1].to_s
|
24
|
+
# recurse unless the second element is nil, which indicates it's the end of the class/module definition
|
25
|
+
if !sexp[2].nil? || (sexp[3].is_a?(Sexp) and CLASS_MOD_DEFS.key?(sexp[3].first))
|
26
|
+
name(sexp.compact[2], list)
|
27
|
+
end
|
21
28
|
end
|
22
29
|
list.join('::')
|
23
30
|
end
|
data/lib/drg/version.rb
CHANGED