shouhizei 0.3.2 → 0.4.1
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 +4 -4
- data/.travis.yml +4 -4
- data/README.md +6 -0
- data/lib/rate_list.yml +13 -3
- data/lib/shouhizei.rb +4 -2
- data/lib/shouhizei/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f45019d28ff15a00ce3faf066ec02753e69197cc981c6cfcfbd0452d9138ac8b
|
4
|
+
data.tar.gz: a2e0d547c3146788e0196655c670b31d318f3bb08b2c38c976ffb0925dbde58c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6f60633c993238cb1fd1c73c59571a8a733fea802ccaef7e118367d45caf1448b3a05be1f379e958a44378992fc7e7132c4614bea4dcea89893ce1613678493
|
7
|
+
data.tar.gz: 820741df77f2395e6c40e34e8890661270f6fe2f03a91606ed6f0cc45a1d7daff42a5bdba41e534e84084070ba03bf101506470df301e7567d3f58b3630aca99
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -37,6 +37,12 @@ Shouhizei.rate_on(Time.zone.local(1997, 4, 1))
|
|
37
37
|
Shouhizei.rate_on(Time.zone.local(2014, 4, 1))
|
38
38
|
=> (2/25)
|
39
39
|
|
40
|
+
Shouhizei.rate_on(Time.zone.local(2019, 10, 1))
|
41
|
+
=> (1/10)
|
42
|
+
|
43
|
+
Shouhizei.rate_on(Time.zone.local(2019, 10, 1), reduced: true) # Return reduced tax rate
|
44
|
+
=> (2/25)
|
45
|
+
|
40
46
|
Shouhizei.rate_on # Returns the current consumption tax
|
41
47
|
=> (2/25)
|
42
48
|
```
|
data/lib/rate_list.yml
CHANGED
data/lib/shouhizei.rb
CHANGED
@@ -8,10 +8,12 @@ module Shouhizei
|
|
8
8
|
RoundDown = 'Down'
|
9
9
|
Round = 'Round'
|
10
10
|
|
11
|
-
def self.rate_on(time = Time.current)
|
11
|
+
def self.rate_on(time = Time.current, reduced: false)
|
12
12
|
date = time.in_time_zone('Asia/Tokyo').to_date
|
13
13
|
rate_list.reverse_each do |key_date, rate|
|
14
|
-
|
14
|
+
rate_key = reduced && rate['reduced'] ? 'reduced' : 'default'
|
15
|
+
|
16
|
+
return rate[rate_key].to_r if date >= key_date
|
15
17
|
end
|
16
18
|
0.0r
|
17
19
|
end
|
data/lib/shouhizei/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shouhizei
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- colorbox
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-11-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -120,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
120
|
version: '0'
|
121
121
|
requirements: []
|
122
122
|
rubyforge_project:
|
123
|
-
rubygems_version: 2.7.
|
123
|
+
rubygems_version: 2.7.8
|
124
124
|
signing_key:
|
125
125
|
specification_version: 4
|
126
126
|
summary: This gem support to calculate Japan consumption tax
|