prism_ext 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -1
- data/Gemfile.lock +1 -1
- data/lib/prism_ext/version.rb +1 -1
- data/lib/prism_ext.rb +18 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9336c9f536dd6a904afc19279998f0e8c63496bb5d540b131c1f78dcbc522f11
|
4
|
+
data.tar.gz: 37a974005acd7f2214c06a9492931cf67b95ba5cbcb73c280c2fc4a81f9ac11e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c63afafb157948463a359768dfd70382c35424a6aa42ffe9c1de07bf4f61939072e9f4989bf32f933f2c1f6dd308d0a5638bf65d05bb45b54af5470aac38e70d
|
7
|
+
data.tar.gz: 8544fd7c5ba4d978789f01bb28ff5a65ccd352b4e99654dfd1d1a4bafe06e98a8daa0a78a47752210c5a4363daab2246d669d4fcaf89c3ed18d3f635ac381cf0
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/lib/prism_ext/version.rb
CHANGED
data/lib/prism_ext.rb
CHANGED
@@ -11,6 +11,16 @@ module PrismExt
|
|
11
11
|
end
|
12
12
|
|
13
13
|
module Prism
|
14
|
+
module FullnameExt
|
15
|
+
def fullname
|
16
|
+
if parent_node&.parent_node&.respond_to?(:fullname)
|
17
|
+
"#{parent_node.parent_node.fullname}::#{constant_path.to_source}"
|
18
|
+
else
|
19
|
+
constant_path.to_source
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
14
24
|
module HashNodeExt
|
15
25
|
def keys
|
16
26
|
elements.select { |element| element.type == :assoc_node }.map(&:key)
|
@@ -60,6 +70,14 @@ module Prism
|
|
60
70
|
include HashNodeExt
|
61
71
|
end
|
62
72
|
|
73
|
+
class ClassNode
|
74
|
+
include FullnameExt
|
75
|
+
end
|
76
|
+
|
77
|
+
class ModuleNode
|
78
|
+
include FullnameExt
|
79
|
+
end
|
80
|
+
|
63
81
|
class Node
|
64
82
|
def to_value
|
65
83
|
case self
|