unparser 0.5.3 → 0.5.4

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: 3bd3746bcbd6711c80f0251429c198b6c7e9128159467af9aec91c468976d6ba
4
- data.tar.gz: b7133c33285430ba21b15e531e2bb125d1ac6d725ccf38603985854a6fb2f75f
3
+ metadata.gz: 83c5893dd093e0f106fefd55abad7931fa775001f53a7449389e40afe0640359
4
+ data.tar.gz: d4caba221ba0b3dcd5afdff73d0df537c24c56f3219e0896e5f67b92b79f6afc
5
5
  SHA512:
6
- metadata.gz: f84831adbb37277301fdc9e5b1f36d26497fe39bae7df9dba921d6fef642c928e0357f6cd3392c6cff23855813ea40aca55585bebfc9afad80b4ea02bc9b18eb
7
- data.tar.gz: 0f305fdee5f1dbc1cfd704a4fca7981c8741fb6954a2fd61ff812895748443acb33354d70c432bb9be481717b797229c466b4363ebe9e09b135fbc88edf6001b
6
+ metadata.gz: 7c7feff0af410abca14daa35166d64b95cda39959f5f6424fb2840a8c5f63b630be4aaba9d22018d745adb2578a9ed7ffc538f4d0c3e6b5224f00e8dd6fceca0
7
+ data.tar.gz: efd0a71dc4988fcf804eab203a4fbed157629c531135d7cbaf2e4ccf5c26c9b1ea2a694c1eb1c2f451f91cfe91b6420d683ff76da6779adaef1e3d015c8ab51b
@@ -19,8 +19,11 @@ module Unparser
19
19
  def dispatch
20
20
  write(MAP.fetch(node.type))
21
21
 
22
- unless children.empty?
23
- emit_arguments
22
+ if children.one? && n_if?(children.first)
23
+ ws
24
+ emitter(children.first).emit_ternary
25
+ else
26
+ emit_arguments unless children.empty?
24
27
  end
25
28
  end
26
29
 
@@ -8,6 +8,14 @@ module Unparser
8
8
 
9
9
  children :condition, :if_branch, :else_branch
10
10
 
11
+ def emit_ternary
12
+ visit(condition)
13
+ write(' ? ')
14
+ visit(if_branch)
15
+ write(' : ')
16
+ visit(else_branch)
17
+ end
18
+
11
19
  private
12
20
 
13
21
  def dispatch
@@ -45,6 +45,7 @@ module Unparser
45
45
  ensure
46
46
  hash
47
47
  hash_pattern
48
+ if
48
49
  in_pattern
49
50
  int
50
51
  kwsplat
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.5.3
4
+ version: 0.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Markus Schirp
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-18 00:00:00.000000000 Z
11
+ date: 2020-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: abstract_type
@@ -142,28 +142,28 @@ dependencies:
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: 0.9.14
145
+ version: 0.10.0
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: 0.9.14
152
+ version: 0.10.0
153
153
  - !ruby/object:Gem::Dependency
154
154
  name: mutant-rspec
155
155
  requirement: !ruby/object:Gem::Requirement
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: 0.9.14
159
+ version: 0.10.0
160
160
  type: :development
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: 0.9.14
166
+ version: 0.10.0
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: rspec
169
169
  requirement: !ruby/object:Gem::Requirement
@@ -198,28 +198,28 @@ dependencies:
198
198
  requirements:
199
199
  - - "~>"
200
200
  - !ruby/object:Gem::Version
201
- version: 1.2.0
201
+ version: 1.3.0
202
202
  type: :development
203
203
  prerelease: false
204
204
  version_requirements: !ruby/object:Gem::Requirement
205
205
  requirements:
206
206
  - - "~>"
207
207
  - !ruby/object:Gem::Version
208
- version: 1.2.0
208
+ version: 1.3.0
209
209
  - !ruby/object:Gem::Dependency
210
210
  name: rubocop
211
211
  requirement: !ruby/object:Gem::Requirement
212
212
  requirements:
213
213
  - - "~>"
214
214
  - !ruby/object:Gem::Version
215
- version: 0.92.0
215
+ version: 1.1.0
216
216
  type: :development
217
217
  prerelease: false
218
218
  version_requirements: !ruby/object:Gem::Requirement
219
219
  requirements:
220
220
  - - "~>"
221
221
  - !ruby/object:Gem::Version
222
- version: 0.92.0
222
+ version: 1.1.0
223
223
  - !ruby/object:Gem::Dependency
224
224
  name: rubocop-packaging
225
225
  requirement: !ruby/object:Gem::Requirement