rufo 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/lib/rufo/formatter.rb +10 -2
- data/lib/rufo/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 35513ffcbf662415975c643eb3dff524ef01b969b64505f221ee2bee96390492
|
4
|
+
data.tar.gz: f23d854af35a0ffbe302537d9d2483ef6f0500dfa9428babe66bca83a4bb81c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 51922a71d81402c5d56ff33cd6c1290fa917607b2a1dd934630098061942cef54f394552fa8975949137f02e824663563a2bdebdcfcf4e89a5239c02c0810e43
|
7
|
+
data.tar.gz: b93dd700b63aa8fa8a9d3444b9cec9b996e9d031f474cab5c45a26d8768f991b89baf819be42483362c61bcfd7dedac955fd8ec1f82270f76a0db55faae31413
|
data/CHANGELOG.md
CHANGED
@@ -10,6 +10,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
10
10
|
|
11
11
|
### Added
|
12
12
|
|
13
|
+
## [0.5.1] - 2019-02-13
|
14
|
+
|
15
|
+
### Fixed
|
16
|
+
|
17
|
+
- Fix bug: Rufo crashes on nested empty hash literal (issue [152](https://github.com/ruby-formatter/rufo/issues/152))
|
18
|
+
- Handle case where rufo would change formatting if run multiple times for hashes in some cases.
|
19
|
+
|
13
20
|
## [0.5.0] - 2019-02-09
|
14
21
|
|
15
22
|
### Added
|
data/lib/rufo/formatter.rb
CHANGED
@@ -2306,6 +2306,7 @@ class Rufo::Formatter
|
|
2306
2306
|
|
2307
2307
|
check :on_lbrace
|
2308
2308
|
write "{"
|
2309
|
+
brace_position = @output.length - 1
|
2309
2310
|
write " " if need_space
|
2310
2311
|
next_token
|
2311
2312
|
|
@@ -2314,6 +2315,13 @@ class Rufo::Formatter
|
|
2314
2315
|
push_hash(node) do
|
2315
2316
|
visit_literal_elements(elements[1], inside_hash: true, token_column: token_column)
|
2316
2317
|
end
|
2318
|
+
char_after_brace = @output[brace_position + 1]
|
2319
|
+
# Check that need_space is set correctly.
|
2320
|
+
if !need_space && !["\n", " "].include?(char_after_brace)
|
2321
|
+
need_space = true
|
2322
|
+
# Add a space in the missing position.
|
2323
|
+
@output.insert(brace_position + 1, " ")
|
2324
|
+
end
|
2317
2325
|
else
|
2318
2326
|
skip_space_or_newline
|
2319
2327
|
end
|
@@ -3844,8 +3852,8 @@ class Rufo::Formatter
|
|
3844
3852
|
if beginning
|
3845
3853
|
node_line(node[1], beginning: beginning)
|
3846
3854
|
else
|
3847
|
-
if node.last == [:string_literal, [:string_content]]
|
3848
|
-
# there's no line number for [:string_literal, [:string_content]]
|
3855
|
+
if node.last == [:string_literal, [:string_content]] || node.last == [:hash, nil]
|
3856
|
+
# there's no line number for [:string_literal, [:string_content]] or [:hash, nil]
|
3849
3857
|
node_line(node[1], beginning: beginning)
|
3850
3858
|
else
|
3851
3859
|
node_line(node.last, beginning: beginning)
|
data/lib/rufo/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rufo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ary Borenszweig
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-02-
|
11
|
+
date: 2019-02-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|