rents 1.0.6 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0c22cc7b5b9ba3becc4f26e2cfe578fe28b3a1c2
4
- data.tar.gz: a8481c0c25b891e34a5523a608e0ad7d0b891424
3
+ metadata.gz: e8d72ef9093b027a4437f1a2cd499e82fa5d1093
4
+ data.tar.gz: d244eeb77446e3cb30b433af713bf4f031061351
5
5
  SHA512:
6
- metadata.gz: 4a876a9c4ab0c915ebe9e62d1ebedc7e4c3446dd0900394d32cae22f5d89d799523249c5185f8057194a9d1535bfcf637ae5f6ac641d3775b9049d944a9661df
7
- data.tar.gz: 7bc2234cc3f8f1ef1fa253565d195a4d43661842fc2218c283e8c93406676bab3b792dab3d514b97ae4edd2c97d9d6793af6119a034caac539fe19a05c8adaea
6
+ metadata.gz: 712dc85f830cf3526d0f4f87f6256f839654ffe5988e4545c57a78745b061e570d7a2bd4aebdb98455370e3a21109d536eb838593911d74a29c7666995999f5c
7
+ data.tar.gz: fd47a2cae1ea33d90ccb3db781d120756edbefb8d5a25456017c301cf4f2f5811093f2d120c14d3b8c67df66496544dafb618f3c8e4170d8aa10c076dcc437f3
@@ -6,6 +6,7 @@ module Rents
6
6
  # Check invalid entry
7
7
  return nil if amount.nil?
8
8
  return amount.to_s if amount.is_a?Integer
9
+ return amount if amount.is_a?(String) && amount.index('.').nil? && amount.index(',').nil?
9
10
  amount = format('%.2f', amount) if amount.to_s.float?
10
11
 
11
12
  if amount.is_a?String
data/lib/rents/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Rents
2
2
  MAJOR = 1
3
3
  MINOR = 0
4
- PATCH = 6
4
+ PATCH = 7
5
5
  VERSION = "#{MAJOR}.#{MINOR}.#{PATCH}"
6
6
  end
@@ -19,6 +19,7 @@ describe Rents::Currency do
19
19
  decimal_expected_value = BigDecimal.new '1999.00'
20
20
  expected_float_unit_cents = '100005'
21
21
  expected_float_decimal_cents = '100050'
22
+ expected_float_without_cents = '100000'
22
23
 
23
24
  # Float values
24
25
  float_with_cents = 1000.55
@@ -39,6 +40,7 @@ describe Rents::Currency do
39
40
  non_formatted_with_cents_converted = Rents::Currency.to_operator_str non_formatted_with_cents
40
41
  float_unit_cents_conv = Rents::Currency.to_operator_str float_unit_cents
41
42
  float_decimal_cents_conv = Rents::Currency.to_operator_str float_decimal_cents
43
+ float_without_cents_conv = Rents::Currency.to_operator_str float_without_cents
42
44
 
43
45
  context 'Decimal to Operator' do
44
46
  # Convert PT_BR
@@ -87,6 +89,10 @@ describe Rents::Currency do
87
89
  it 'decimal cents con must be on Operator format' do
88
90
  expect(float_decimal_cents_conv).to be == expected_float_decimal_cents
89
91
  end
92
+
93
+ it 'no cents must be an Operator format' do
94
+ expect(float_without_cents_conv).to be == expected_float_without_cents
95
+ end
90
96
  end
91
97
 
92
98
  context 'Operator to Decimal' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rents
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ilton Garcia