fiscalizer 0.0.10 → 0.0.11

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: 9d3deca10278b7a6685273b26b4b3e65f6575046
4
- data.tar.gz: 9cb42dc014e0367a16bcfd240b740c551775bc4d
3
+ metadata.gz: 93910f6f4a1a2690c1555b9816acd56d7100564f
4
+ data.tar.gz: e4a9c175caba575afbdf9d1c5728d68633e88754
5
5
  SHA512:
6
- metadata.gz: 34b22ca992b6ea22ef0618d8d71bc815ece45ede9b6f208623a18524abb824beb6c09e82e83e5af7d8d520c0ffc18812a489409b233128d2ffdda72d97f5b999
7
- data.tar.gz: eea535e9b0a0b987374f2129d595878c5fea4f1cbbabdb9a0f0430f775f6b11c22c3e4efc987b3044ce14f245bfd64406bd03b7e9c670de2907631f89d64c3b5
6
+ metadata.gz: 02011656ce76e0c7e7a86d5df035456f719a2c5bb08e4f71454c5a4ab7f250d5a6477d18e2482a628b3643f80cb344d5b70beaec59da4f62a077ea62fea90e75
7
+ data.tar.gz: a1d9e1eb6c33fb3294e579f8c78690665b44629a6fffb8e80125ca65942f69dca2d80fe8f00dae7e95f4ca6610333275efb1449fbe368c2bdbdf3c42a9667655
@@ -1,47 +1,37 @@
1
1
  class Fiscalizer
2
- class Tax
3
-
4
- attr_accessor :base, :rate, :name
5
-
6
- def initialize base: 0.0, rate: 0.0, name: ""
7
- @base = base
8
- @rate = rate
9
- @name = name
10
- end # initialize
11
-
12
- # Math
13
- def base
14
- return @base.to_f.round(2)
15
- end # base
16
-
17
- def rate
18
- return @rate.to_f.round(2)
19
- end # rate
20
-
21
- def total
22
- return (base * (rate / 100.0) ).round(2)
23
- end # total
24
-
25
- def summed
26
- return (base + total).round(2)
27
- end # summed
28
-
29
- # Convert to string
30
- def base_str
31
- return ("%15.2f" % base).strip
32
- end # base_str
33
-
34
- def rate_str
35
- return ("%3.2f" % rate).strip
36
- end # rate_str
37
-
38
- def total_str
39
- return ("%15.2f" % total).strip
40
- end # total_str
41
-
42
- def summed_str
43
- return ("%15.2f" % summed ).strip
44
- end # summed_str
45
-
46
- end # Tax
47
- end # Fiscalizer
2
+ class Tax
3
+ attr_accessor :base, :rate, :name, :total, :summed
4
+
5
+ def initialize(base: 0.0, rate: 0.0, name: '', total: nil, summed: nil)
6
+ @base = base
7
+ @rate = rate
8
+ @name = name
9
+ @total = total
10
+ @summed = summed
11
+ end
12
+
13
+ def total
14
+ @total || (base.to_f * (rate.to_f / 100.0)).round(2)
15
+ end
16
+
17
+ def summed
18
+ @summed || (base.to_f + total.to_f).round(2)
19
+ end
20
+
21
+ def base_str
22
+ format('%15.2f', base).strip
23
+ end
24
+
25
+ def rate_str
26
+ format('%3.2f', rate).strip
27
+ end
28
+
29
+ def total_str
30
+ format('%15.2f', total).strip
31
+ end
32
+
33
+ def summed_str
34
+ format('%15.2f', summed).strip
35
+ end
36
+ end
37
+ end
@@ -1,3 +1,3 @@
1
1
  class Fiscalizer
2
- VERSION = "0.0.10"
2
+ VERSION = "0.0.11"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fiscalizer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stanko Krtalić Rusendić
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-31 00:00:00.000000000 Z
11
+ date: 2016-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -130,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
130
130
  version: '0'
131
131
  requirements: []
132
132
  rubyforge_project:
133
- rubygems_version: 2.2.2
133
+ rubygems_version: 2.5.1
134
134
  signing_key:
135
135
  specification_version: 4
136
136
  summary: A gem that automatically handles fiscalization