parser_node_ext 0.4.0 → 0.4.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 54f47aa3cbd58cec27d151340e935bf687be7c9cb63c523cdd8174869aebaf7e
4
- data.tar.gz: e3e940453872b9bd0abd24a2b11b8d07c59e35613717b365b9810b0461cd1f28
3
+ metadata.gz: 07a901b2c76fb4f39403891f6191fcb865beeb0847108522765cde0fe06bc6cd
4
+ data.tar.gz: c4720a3f2df5c08ef3a6f3ef2f18c33a5cf02aac1ef94c351d5ac37eaa9f1af1
5
5
  SHA512:
6
- metadata.gz: 573b0ae05b18d25c04bc1efeac3f763c3872eee302d1b23fa11c054d32a1ea84afc86e7984e3ae6892f55bc39c4b0c8faadf133da1d53af6b387b8a57f55f685
7
- data.tar.gz: b8b718a0dec190ce6b563fa9edd842d38869a58f7bc43799297e6ed88268f2fd5427315791c5b4cec62046d510056165b60683d36709d86790675eb19b14b655
6
+ metadata.gz: f10a88ff6c89658b50e6b2d36f433a88595816f0c36dabdf18f16c29c2096bbb5de80045791f436ac77d9d781baf5ed9e5205a5928fade062add8efc0c9a2fe1
7
+ data.tar.gz: 88bb4871e94a2d1c3924f3787108242d7c1ac7048c3820a751365bc0c4af7f02784262dc8c07bd3e26ed8a9cd95a1b2c095c046dfb4c48f262fb3ab226394c0a
data/CHANGELOG.md CHANGED
@@ -1,8 +1,12 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.4.1 (2022-10-21)
4
+
5
+ * Update error message
6
+
3
7
  ## 0.4.0 (2022-07-07)
4
8
 
5
- * raise `MethodNotSupported` error
9
+ * Raise `MethodNotSupported` error
6
10
 
7
11
  ## 0.3.0 (2022-07-04)
8
12
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- parser_node_ext (0.4.0)
4
+ parser_node_ext (0.4.1)
5
5
  parser
6
6
 
7
7
  GEM
@@ -9,7 +9,7 @@ GEM
9
9
  specs:
10
10
  ast (2.4.2)
11
11
  diff-lcs (1.5.0)
12
- parser (3.1.2.0)
12
+ parser (3.1.2.1)
13
13
  ast (~> 2.4.1)
14
14
  rake (13.0.6)
15
15
  rspec (3.11.0)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ParserNodeExt
4
- VERSION = "0.4.0"
4
+ VERSION = "0.4.1"
5
5
  end
@@ -93,7 +93,7 @@ module ParserNodeExt
93
93
  index = TYPE_CHILDREN[type]&.index(method_name)
94
94
  return children[index] if index
95
95
 
96
- raise MethodNotSupported, "#{method_name} is not handled for #{debug_info}"
96
+ raise MethodNotSupported, "#{method_name} is not supported for #{self}"
97
97
  end
98
98
  end
99
99
 
@@ -110,7 +110,7 @@ module ParserNodeExt
110
110
  index = TYPE_CHILDREN[type]&.index(:left_value)
111
111
  return children[index] if index
112
112
 
113
- raise MethodNotSupported, "#{left_value} is not handled for #{debug_info}"
113
+ raise MethodNotSupported, "#{left_value} is not supported for #{self}"
114
114
  end
115
115
 
116
116
  # Get arguments of node.
@@ -131,7 +131,7 @@ module ParserNodeExt
131
131
  when :defined?
132
132
  children
133
133
  else
134
- raise MethodNotSupported, "arguments is not handled for #{debug_info}"
134
+ raise MethodNotSupported, "arguments is not supported for #{self}"
135
135
  end
136
136
  end
137
137
 
@@ -155,7 +155,7 @@ module ParserNodeExt
155
155
 
156
156
  :begin == children[3].type ? children[3].body : children[3..-1]
157
157
  else
158
- raise MethodNotSupported, "body is not handled for #{debug_info}"
158
+ raise MethodNotSupported, "body is not supported for #{self}"
159
159
  end
160
160
  end
161
161
 
@@ -170,7 +170,7 @@ module ParserNodeExt
170
170
  if :if == type
171
171
  children[0]
172
172
  else
173
- raise MethodNotSupported, "condition is not handled for #{debug_info}"
173
+ raise MethodNotSupported, "condition is not supported for #{self}"
174
174
  end
175
175
  end
176
176
 
@@ -184,7 +184,7 @@ module ParserNodeExt
184
184
  if :hash == type
185
185
  children.map { |child| child.children[0] }
186
186
  else
187
- raise MethodNotSupported, "keys is not handled for #{debug_info}"
187
+ raise MethodNotSupported, "keys is not supported for #{self}"
188
188
  end
189
189
  end
190
190
 
@@ -198,7 +198,7 @@ module ParserNodeExt
198
198
  if :hash == type
199
199
  children.map { |child| child.children[1] }
200
200
  else
201
- raise MethodNotSupported, "keys is not handled for #{debug_info}"
201
+ raise MethodNotSupported, "keys is not supported for #{self}"
202
202
  end
203
203
  end
204
204
 
@@ -213,7 +213,7 @@ module ParserNodeExt
213
213
  if :hash == type
214
214
  children.any? { |pair_node| pair_node.key.to_value == key }
215
215
  else
216
- raise MethodNotSupported, "key? is not handled for #{debug_info}"
216
+ raise MethodNotSupported, "key? is not supported for #{self}"
217
217
  end
218
218
  end
219
219
 
@@ -229,7 +229,7 @@ module ParserNodeExt
229
229
  value_node = children.find { |pair_node| pair_node.key.to_value == key }
230
230
  value_node&.value
231
231
  else
232
- raise MethodNotSupported, "hash_value is not handled for #{debug_info}"
232
+ raise MethodNotSupported, "hash_value is not supported for #{self}"
233
233
  end
234
234
  end
235
235
 
@@ -330,19 +330,6 @@ module ParserNodeExt
330
330
 
331
331
  super
332
332
  end
333
-
334
- # Return the debug info.
335
- #
336
- # @return [String] file, line, source and node.
337
- def debug_info
338
- "\n" +
339
- [
340
- "file: #{loc.expression.source_buffer.name}",
341
- "line: #{loc.expression.line}",
342
- "source: #{to_source}",
343
- "node: #{inspect}"
344
- ].join("\n")
345
- end
346
333
  end
347
334
  end
348
335
  end
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: 0.4.0
4
+ version: 0.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: 2022-07-07 00:00:00.000000000 Z
11
+ date: 2022-10-21 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.3.7
66
+ rubygems_version: 3.3.22
67
67
  signing_key:
68
68
  specification_version: 4
69
69
  summary: extend parser node