parser_node_ext 1.3.2 → 1.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: eaf18e510d010abe73429864f55581cdc6ee4f1dfea42ae2c7e7aebd304f0251
4
- data.tar.gz: dd1e60ba561f999d822b8c35ac4bb657680fd33c23e606b85f26e859f121b7f9
3
+ metadata.gz: 9abeb78d465d5e90a8cd5d921d8cf4e18ccbab4b4cb55997fb49bea0255125a0
4
+ data.tar.gz: c084ba2e63f1575d8167aac4a970966a0ef0d7ce9b8da2e19dc5ce360d16ee27
5
5
  SHA512:
6
- metadata.gz: c4ced2a132a1870df30aaeb0536291a4c239a93bfa7dfc2a8e609f845031b7907358c9158c515b6a27031bfc3c5cb75e657b60662c6f3d09ae432dcd2874c2fb
7
- data.tar.gz: f38f42bf0d8a7a2b86f435efa04fc9192c36c0a2a1d1ee253a35207fd55ac88aba9388021979b24ac0b9c31111ddc3426a1dec97a69ea81c514254852639fc79
6
+ metadata.gz: d30a4c0ef68c37ab8232dbadacabc4d28099395bbebb3b54e3de6f2c0697de5fff91ba83ec81fc9ba14b98bd4226c59f1da1a1dff3349c39e2e5bc6bce5ca732
7
+ data.tar.gz: f6f7b429dafe2547a302efd8b58dbdb65cc8700de0b09b3373e30efb5042358db1ceabfde5334237d18c8ad630cf11f879862c9c55e212556bf33ce9461b5b0f
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 1.4.1 (2024-07-17)
4
+
5
+ * Add `fullname` to `module` and `class`
6
+
7
+ ## 1.4.0 (2024-07-16)
8
+
9
+ * Require `parser_node_ext/parent_node_ext` back
10
+
3
11
  ## 1.3.2 (2024-04-18)
4
12
 
5
13
  * Remove `hash_pair` and `hash_value` methods
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- parser_node_ext (1.3.2)
4
+ parser_node_ext (1.4.1)
5
5
  parser
6
6
 
7
7
  GEM
@@ -9,10 +9,10 @@ GEM
9
9
  specs:
10
10
  ast (2.4.2)
11
11
  diff-lcs (1.5.0)
12
- parser (3.3.0.5)
12
+ parser (3.3.4.0)
13
13
  ast (~> 2.4.1)
14
14
  racc
15
- racc (1.7.3)
15
+ racc (1.8.0)
16
16
  rake (13.0.6)
17
17
  rspec (3.11.0)
18
18
  rspec-core (~> 3.11.0)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ParserNodeExt
4
- VERSION = "1.3.2"
4
+ VERSION = "1.4.1"
5
5
  end
@@ -3,6 +3,7 @@
3
3
  require_relative "parser_node_ext/version"
4
4
 
5
5
  require 'parser'
6
+ require_relative "parser_node_ext/parent_node_ext"
6
7
 
7
8
  module ParserNodeExt
8
9
  class MethodNotSupported < StandardError; end
@@ -129,6 +130,16 @@ module ParserNodeExt
129
130
  end
130
131
  end
131
132
 
133
+ def fullname
134
+ if %i[class module].include?(type)
135
+ if parent&.respond_to?(:fullname)
136
+ "#{parent.fullname}::#{name.to_source}"
137
+ else
138
+ name.to_source
139
+ end
140
+ end
141
+ end
142
+
132
143
  # Get arguments of node.
133
144
  # It supports :block, :csend, :def, :defined?, :defs, :send, :yeild nodes.
134
145
  # @example
@@ -138,7 +149,7 @@ module ParserNodeExt
138
149
  # @raise [MethodNotSupported] if calls on other node.
139
150
  def arguments
140
151
  case type
141
- when :def, :block
152
+ when :def
142
153
  children[1].type == :args ? children[1].children : [children[1]]
143
154
  when :defs
144
155
  children[2].type == :args ? children[2].children : [children[2]]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parser_node_ext
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2
4
+ version: 1.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Huang
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-04-18 00:00:00.000000000 Z
11
+ date: 2024-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: parser
@@ -63,7 +63,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
63
63
  - !ruby/object:Gem::Version
64
64
  version: '0'
65
65
  requirements: []
66
- rubygems_version: 3.5.3
66
+ rubygems_version: 3.5.14
67
67
  signing_key:
68
68
  specification_version: 4
69
69
  summary: extend parser node