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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3cc69b097951aa19906db6c6467bd29322074e88050b7841b0dffa77efa14a77
4
- data.tar.gz: 0d5189900486cd8727328b4b8bbd1613cba14f14b066098fa78234579a62f529
3
+ metadata.gz: 9336c9f536dd6a904afc19279998f0e8c63496bb5d540b131c1f78dcbc522f11
4
+ data.tar.gz: 37a974005acd7f2214c06a9492931cf67b95ba5cbcb73c280c2fc4a81f9ac11e
5
5
  SHA512:
6
- metadata.gz: 2aa74bdaf66a7a32b4a41e2d62fbbb0363d290b1c228becd25664708b0757c5be3ed5b3cf3c8092602dd75f12699b0c2238719c2ddf95804a4e5fbd722a73a35
7
- data.tar.gz: 38c625e90fde3ce91bab147f925598382b08af68d207d2da691ead3d5eca4825cc713cfb307a6eb38a73b62c86375642dad35778e7dbbb0a929cc22c47c2cad1
6
+ metadata.gz: c63afafb157948463a359768dfd70382c35424a6aa42ffe9c1de07bf4f61939072e9f4989bf32f933f2c1f6dd308d0a5638bf65d05bb45b54af5470aac38e70d
7
+ data.tar.gz: 8544fd7c5ba4d978789f01bb28ff5a65ccd352b4e99654dfd1d1a4bafe06e98a8daa0a78a47752210c5a4363daab2246d669d4fcaf89c3ed18d3f635ac381cf0
data/CHANGELOG.md CHANGED
@@ -1,8 +1,12 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.4.1 (2024-07-17)
4
+
5
+ * Add `fullname` to `ModuleNode` and `ClassNode`
6
+
3
7
  ## 0.4.0 (2024-07-16)
4
8
 
5
- * require `prism_ext/parent_node_ext` back
9
+ * Require `prism_ext/parent_node_ext` back
6
10
 
7
11
  ## 0.3.8 (2024-07-06)
8
12
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- prism_ext (0.4.0)
4
+ prism_ext (0.4.1)
5
5
  prism
6
6
 
7
7
  GEM
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PrismExt
4
- VERSION = "0.4.0"
4
+ VERSION = "0.4.1"
5
5
  end
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prism_ext
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Huang