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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0200f47ad7a7b3b4db0cc305cc01c58e5f33e06f
4
- data.tar.gz: bbc3bb4107a01d04cecfefb3437388749cd7cf8c
3
+ metadata.gz: 795337833ac1e0a311d095cd06e138e090e813e0
4
+ data.tar.gz: a24f9b486bca041b900d19d5ca3d72d2857d5d16
5
5
  SHA512:
6
- metadata.gz: 159b269436d56dce50cd217743b5423f7b6206a5ae64368b0a0aa60461f58fb8d95f030447c75787bac7eadab920c86801765561ef131485fdcc1cdaf3360f9c
7
- data.tar.gz: 3c03b30b349a34338caf00e6686eafe3f13ec49e30e18737c57daa058c20a55683c07688daebdfd9ae1404c4b757093f706fbcac062ca105398a8e677ef6c120
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.find_index{|x| x[2] == '='} #find first equal sign
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.find_index{|x| x[2] == '='} #find first equal sign
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
@@ -1,3 +1,3 @@
1
1
  module RBeautify
2
- VERSION = "0.94.2"
2
+ VERSION = "0.95.0"
3
3
  end
@@ -1,6 +1,7 @@
1
1
  require File.expand_path('../lib/ruby-beautify/version', __FILE__)
2
2
 
3
3
  Gem::Specification.new do |gem|
4
+ gem.required_ruby_version = '>= 2.0'
4
5
  gem.name = 'ruby-beautify'
5
6
  gem.summary = "a cli tool (and module) to beautify ruby code."
6
7
  gem.description = gem.summary
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
@@ -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.94.2
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-13 00:00:00.000000000 Z
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
  - - ">="