ripper_ruby_parser 1.5.0 → 1.5.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: 05e260a0b747a456d0a25ce09e6607bcaf29fcfef68eec466c87e502ad27d435
4
- data.tar.gz: 77a0985075b11dd8461dd96a4b1def05c34bee338713701cfc2fa0fa026414bd
3
+ metadata.gz: bad890447c64972884e94b2470b0fcb8114aad1af6e9b44c27d05f1187a789d3
4
+ data.tar.gz: ea2965906b883f6b8f1d7481cd04d89c3d1dcc57c8bba022adfc27b1af01df1a
5
5
  SHA512:
6
- metadata.gz: a9d499d3e3d60b5d758884e0f4c3667e19c58943f0662aa0936e8188ba6a8767b844734a930e32e7485196abc5e050986f27cd491829500c639562de3d1e54e9
7
- data.tar.gz: 8476d87b6a80339014fc7e47a1d795ce6554d9f89650a272ea7040a7e84922b491ef0dd48a2fa858d436b3538d5c670624303a5f9a11b4f501fc3351a3d6aa15
6
+ metadata.gz: c4ef6f13a7914774863c9503dfd27dd099e5adf1f122c7f7f38105b9b7570a7dfe5b51ac744a2a7a200b6c7012937477a933f2651b7e48e7b41b70a81f6bb7dc
7
+ data.tar.gz: c28f34964b94a8d7bd28fb47924d8ffd7f99104bb22ce90de48ed6b9ac2c1b32b789bf5c5059bc02c7d29ae5d98622cfc72f0d41d6eba6fc77f177e65679917e
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.5.1 / 2019-03-21
4
+
5
+ * Fix handling of singleton methods whose names are keywords
6
+ ([#66](https://github.com/mvz/ripper_ruby_parser/pull/66))
7
+
3
8
  ## 1.5.0 / 2019-03-18
4
9
 
5
10
  * Process embedded documents as comments
@@ -19,7 +19,9 @@ module RipperRubyParser
19
19
  end
20
20
 
21
21
  def process_defs(exp)
22
- _, receiver, _, method, params, body = exp.shift 6
22
+ _, receiver, _, ident, params, body = exp.shift 6
23
+
24
+ ident, = extract_node_symbol_with_position ident
23
25
 
24
26
  in_method do
25
27
  params = convert_method_args(process(params))
@@ -27,10 +29,7 @@ module RipperRubyParser
27
29
  body = with_kwrest(kwrest) { method_body(body) }
28
30
  end
29
31
 
30
- s(:defs,
31
- process(receiver),
32
- extract_node_symbol(process(method)),
33
- params, *body)
32
+ s(:defs, process(receiver), ident, params, *body)
34
33
  end
35
34
 
36
35
  def process_return(exp)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RipperRubyParser
4
- VERSION = '1.5.0'
4
+ VERSION = '1.5.1'
5
5
  end
@@ -177,6 +177,12 @@ describe RipperRubyParser::Parser do
177
177
  must_be_parsed_as s(:defn, :+, s(:args),
178
178
  s(:nil))
179
179
  end
180
+
181
+ it 'works when the method name is a keyword' do
182
+ 'def for; end'.
183
+ must_be_parsed_as s(:defn, :for, s(:args),
184
+ s(:nil))
185
+ end
180
186
  end
181
187
 
182
188
  describe 'for singleton method definitions' do
@@ -207,6 +213,14 @@ describe RipperRubyParser::Parser do
207
213
  s(:args, :"*baz"),
208
214
  s(:nil))
209
215
  end
216
+
217
+ it 'works when the method name is a keyword' do
218
+ 'def foo.for; end'.
219
+ must_be_parsed_as s(:defs,
220
+ s(:call, nil, :foo),
221
+ :for, s(:args),
222
+ s(:nil))
223
+ end
210
224
  end
211
225
 
212
226
  describe 'for the alias statement' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ripper_ruby_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matijs van Zuijlen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-18 00:00:00.000000000 Z
11
+ date: 2019-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sexp_processor