ruby-beautify 0.94.2 → 0.95.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/WHATSNEW.md +4 -0
- data/bin/rbeautify +1 -1
- data/bin/ruby-beautify +1 -1
- data/lib/ruby-beautify/version.rb +1 -1
- data/ruby-beautify.gemspec +1 -0
- data/spec/example.rb +22 -0
- data/spec/example_beautified.rb +22 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 795337833ac1e0a311d095cd06e138e090e813e0
|
4
|
+
data.tar.gz: a24f9b486bca041b900d19d5ca3d72d2857d5d16
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2cc470ec899d8073ba989c921f1025f72a8a2728efc644386441c44df1231615e2c139940d6614d67d5d60dfb71472ab45cc92c219915d265c2d10d003c163c2
|
7
|
+
data.tar.gz: 1a1821d12d0c711842bc2838e6d1096ebd3a5cd62cff37ec85ca225d123533a7ed707fc7206b0a3ae49a57b85f27fbee04945b7b10ba718bd2c7740f3124f794
|
data/WHATSNEW.md
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
## 0.95.0
|
2
|
+
* Merged a quick fix from @pkuykendall to catch block assignments with ||=
|
3
|
+
* Added a required version to the gemspec.
|
4
|
+
|
1
5
|
## 0.94.2
|
2
6
|
* Support for case statements thanks to @pkuykendall.
|
3
7
|
* @pkuykendall also brings us proper syntax formatting for assignments from the return value of an if check (that's a mouth full).
|
data/bin/rbeautify
CHANGED
@@ -151,7 +151,7 @@ end
|
|
151
151
|
# test for assignment from a block
|
152
152
|
def contains_block_assignment?(line_lex)
|
153
153
|
compacted_line = line_lex.reject{|x| x[1] == :on_sp} #remove spaces
|
154
|
-
idx = compacted_line.
|
154
|
+
idx = compacted_line.rindex{|x| ['=', '||='].include? x[2]} #find last equal
|
155
155
|
if idx
|
156
156
|
return @open_block_start.include?(compacted_line[idx+1][2]) #check for if/begin block
|
157
157
|
end
|
data/bin/ruby-beautify
CHANGED
@@ -151,7 +151,7 @@ end
|
|
151
151
|
# test for assignment from a block
|
152
152
|
def contains_block_assignment?(line_lex)
|
153
153
|
compacted_line = line_lex.reject{|x| x[1] == :on_sp} #remove spaces
|
154
|
-
idx = compacted_line.
|
154
|
+
idx = compacted_line.rindex{|x| ['=', '||='].include? x[2]} #find last equal
|
155
155
|
if idx
|
156
156
|
return @open_block_start.include?(compacted_line[idx+1][2]) #check for if/begin block
|
157
157
|
end
|
data/ruby-beautify.gemspec
CHANGED
data/spec/example.rb
CHANGED
@@ -122,3 +122,25 @@ end
|
|
122
122
|
rescue
|
123
123
|
'FALSE'
|
124
124
|
end
|
125
|
+
|
126
|
+
# Test or-equals
|
127
|
+
def expensive_value
|
128
|
+
@expensive_value ||= begin
|
129
|
+
if conn.active?
|
130
|
+
expensive_call
|
131
|
+
else
|
132
|
+
:none
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
# Test multiple or-equals
|
138
|
+
def expensive_value
|
139
|
+
@expensive_value ||= @cached_value ||= begin
|
140
|
+
if conn.active?
|
141
|
+
expensive_call
|
142
|
+
else
|
143
|
+
:none
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
data/spec/example_beautified.rb
CHANGED
@@ -122,3 +122,25 @@ response = begin
|
|
122
122
|
rescue
|
123
123
|
'FALSE'
|
124
124
|
end
|
125
|
+
|
126
|
+
# Test or-equals
|
127
|
+
def expensive_value
|
128
|
+
@expensive_value ||= begin
|
129
|
+
if conn.active?
|
130
|
+
expensive_call
|
131
|
+
else
|
132
|
+
:none
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
|
137
|
+
# Test multiple or-equals
|
138
|
+
def expensive_value
|
139
|
+
@expensive_value ||= @cached_value ||= begin
|
140
|
+
if conn.active?
|
141
|
+
expensive_call
|
142
|
+
else
|
143
|
+
:none
|
144
|
+
end
|
145
|
+
end
|
146
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-beautify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.95.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ernie Brodeur
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -89,7 +89,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
89
89
|
requirements:
|
90
90
|
- - ">="
|
91
91
|
- !ruby/object:Gem::Version
|
92
|
-
version: '0'
|
92
|
+
version: '2.0'
|
93
93
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
95
|
- - ">="
|