unparser 0.6.14 → 0.6.15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/unparser/emitter/pair.rb +18 -3
  3. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f7ba6fe43070f8f0f156310dc9b588dfcb0dc9aef45c1eb639250efb1622d3dd
4
- data.tar.gz: b73a4e1be5514ca85e2014be9008b59ed1a6847f370682a505d8e718d2e7cbef
3
+ metadata.gz: 9d1d0033d21b1c64de6affcc9c555797edf5206dc2947484ff8391e3c8e739ce
4
+ data.tar.gz: 60732ffbcc8a43cd2f04a6cba76e955b7e764ada9d201cd51a0a624d093b3659
5
5
  SHA512:
6
- metadata.gz: c360281c3941b7094ee10e09718e6b37f2de361af373942313692728f95160b3c94b979b3fe352804c7f91768edaf3e448e7ec406d392c8eeb68e1f9002ade62
7
- data.tar.gz: 962d1c44aaa8d94aae4e60997dd75a2c8535b6a6f054f5aa382ff112c3c335a8a67d01af5700781073dce1e6e1b1f20567d7b532b2e1b7fc7dca71a701b26b10
6
+ metadata.gz: 77db441f3e4da2b584065c597796d4adbb08b07e481b43ee85c80218375cbf8932bae847727afa9abee0be02ee5dea1c2effd5caa70216a5bafa34007d0c3820
7
+ data.tar.gz: c180d28c4ac14fe5d6b5756350592b472cd084ce932309fd6cc87f042dffb1f1870dd194260e71b53dbac71fa648bd359c7b4d3c8860c7508f7cc854c9d2ef25
@@ -17,7 +17,7 @@ module Unparser
17
17
  def dispatch
18
18
  if colon?
19
19
  emit_colon
20
- unless implicit_value?
20
+ unless implicit_value_lvar? || implicit_value_send?
21
21
  write(' ')
22
22
  visit(value)
23
23
  end
@@ -36,8 +36,23 @@ module Unparser
36
36
  write(key.children.first.to_s, ':')
37
37
  end
38
38
 
39
- def implicit_value?
40
- n_lvar?(value) && value.children.first.equal?(key.children.first)
39
+ def key_value
40
+ key.children.first
41
+ end
42
+
43
+ def implicit_value_lvar?
44
+ n_lvar?(value) && value.children.first.equal?(key_value)
45
+ end
46
+
47
+ def implicit_value_send?
48
+ children = value.children
49
+
50
+ n_send?(value) \
51
+ && !key_value.end_with?('?') \
52
+ && !key_value.end_with?('!') \
53
+ && children.fetch(0).nil? \
54
+ && children.fetch(1).equal?(key_value) \
55
+ && children.at(2).nil?
41
56
  end
42
57
  end
43
58
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unparser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.14
4
+ version: 0.6.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Markus Schirp
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-10 00:00:00.000000000 Z
11
+ date: 2024-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: diff-lcs
@@ -268,7 +268,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
268
268
  - !ruby/object:Gem::Version
269
269
  version: '0'
270
270
  requirements: []
271
- rubygems_version: 3.3.26
271
+ rubygems_version: 3.5.9
272
272
  signing_key:
273
273
  specification_version: 4
274
274
  summary: Generate equivalent source for parser gem AST nodes