store_as_int 0.0.18 → 0.0.19

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/store_as_int/base.rb +7 -5
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4d911577180d2102c143b2c5b04846830e8cec0a3c9e9687014ee0d0c628720e
4
- data.tar.gz: dbe23a3fd66f334f4c826a6e3acadf56e25e0ed2c43e3cf4a174d56b85e3a6ef
3
+ metadata.gz: 02ea39aea7ea5f1df28231ca3edfe10611cc901cf29419d69a4d4cc367b6d0a1
4
+ data.tar.gz: cb7b188beb213d0f869a7b8f8a3259092ed4298175bb0765460e932dc26deea9
5
5
  SHA512:
6
- metadata.gz: 98313ea582b7d00daeee8bf5e80c8b36b91e6cbb9acd3d31a9e8766f5d99fb4399740d010db6962ee0aa0a9269c4dc6a460cd4196e7893208be2653b52060a5d
7
- data.tar.gz: c56730ef9aebb7088eba481f811cd17648989afb20df20ebabd4d92948425323821df87cb47b9101a7b91edd09289d12e8e90ccbcab7ca805dcc7e86ec90147b
6
+ metadata.gz: 9744a5fbbb4f888f5b1a70ae9bf3769bd4dcb6e023270997527d7f07d544502a7e3fbf980700949648a452ac075c87b4b5e23f2f2765721c7e6621032fe19fa8
7
+ data.tar.gz: c12682e69f310b3bfc6b36ca4e18e2777e810b414bb5d28a02ed4cb3ea3b893737425039fac62bec6453c5c24700c23109c3d71d378b887f476879586df8809c
@@ -296,11 +296,12 @@ module StoreAsInt
296
296
  def str_format
297
297
  @str_format ||= self.class.str_format || ->(passed, w_sym, padding) do
298
298
  return '' unless w_sym || passed.present? || (padding.to_i > 0)
299
- str = "#{
299
+ prefix = "#{
300
300
  passed.negative_sign
301
301
  }#{
302
- (w_sym ? passed.sym : '').to_s.ljust(padding.to_i, ' ')
303
- }#{
302
+ w_sym ? passed.sym : ''
303
+ }"
304
+ str = "#{
304
305
  passed.decimals ?
305
306
  sprintf("%0.0#{passed.decimals.to_i}f", passed.to_d.abs) :
306
307
  passed.to_i.to_s
@@ -308,9 +309,10 @@ module StoreAsInt
308
309
 
309
310
  str[-1] =
310
311
  str[-1].
311
- gsub(/(\d{3})(?=\d)/, w_sym ? '\\1,' : '\\1')
312
+ gsub(/(\d{3})(?=\d)/, w_sym ? '\\1,' : '\\1').
313
+ ljust(padding.to_i, ' ')
312
314
 
313
- str.join('.').reverse
315
+ "#{prefix}#{str.join('.').reverse}"
314
316
  end
315
317
  end
316
318
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: store_as_int
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.18
4
+ version: 0.0.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sampson Crowley