shopify-money 1.1.0 → 1.1.1

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: 2ee2b0d21b57f4ab542e863b1e4726ef3f6185968313750e2fcb5903a7c901b7
4
- data.tar.gz: 331d13d263aa4d502229ec33c3dfb098dbfa8892e3e8dca4a74774fe434f0178
3
+ metadata.gz: ae2953d70e905d5f2425b6c334f5e8a920ec749a0e82341739b90dee7c446254
4
+ data.tar.gz: 42fd32e212f52fb97c366cc39fe8bf462fff7be09ebb54690a6c7a3d80e5c08d
5
5
  SHA512:
6
- metadata.gz: 8e92eca63c1264797f09f09482ff0d02af00440f018c74a25341110f92db14d4ff105e25001f397c87b98241dadf0bd8eab6532f1faf01d7b1930bdef09038ce
7
- data.tar.gz: a1bf291e6a87b3d356711f5852399869bdb6478d508a16c2bd8a23acdeb7a94eb7ed6a24a47d7506ae1219960a80c49fabfcbbb26c5f5d7c969978819af62c34
6
+ metadata.gz: 538545671ca1a88fd930f5148b0477a2558a6166764439a2a30ff3a7b34f7057fbf510c11f238d44cae13296c2eb81cfd07ffa510bfacae2b8780c49920404ed
7
+ data.tar.gz: 67944f9355d6b02e61c0e90f9e34cfd3ec7d3adea2f6dfbb45fc88241e38af516ad89726bd13b2e4a211e4adb26741f842904f92095e678808e1e25b871abfde
data/lib/money/money.rb CHANGED
@@ -232,9 +232,12 @@ class Money
232
232
  if units == 0
233
233
  sprintf("%d", rounded_value)
234
234
  else
235
- sign = rounded_value < 0 ? '-' : ''
236
- rounded_value = rounded_value.abs
237
- sprintf("%s%d.%0#{units}d", sign, rounded_value.truncate, rounded_value.frac * (10 ** units))
235
+ formatted = rounded_value.to_s("F")
236
+ decimal_digits = formatted.size - formatted.index(".") - 1
237
+ (units - decimal_digits).times do
238
+ formatted << '0'
239
+ end
240
+ formatted
238
241
  end
239
242
  end
240
243
  alias_method :to_s, :to_fs
data/lib/money/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  class Money
3
- VERSION = "1.1.0"
3
+ VERSION = "1.1.1"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shopify-money
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify Inc