tax_calculator_2022 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 4418b34dddf4825c41904494bb5aa1b279398fa6f81104816d17867078536e8a
4
+ data.tar.gz: d8b789fd7b952d7df70f0c69001719d74c9cc9514601b8f8a358bb111fd0e9b9
5
+ SHA512:
6
+ metadata.gz: e261fd6f772ade113fcb0889dc1ed9c59af4bf589052315ae8afecc5c4febc626824df6ca790f14d76b1f966343a5cffbf8071e3645977ab6697ab52121adae1
7
+ data.tar.gz: aaf13bcc56af30889f55189c286f335207f75a4d6b1b74bdcd829a0286c9b77135c6354282205b2a649afa594755125ef39a6cd66d98a8d389ed44cd83cc0370
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in tax_calculator_2022.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # TaxCalculator2022
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/tax_calculator_2022`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Install the gem and add to the application's Gemfile by executing:
10
+
11
+ $ bundle add tax_calculator_2022
12
+
13
+ If bundler is not being used to manage dependencies, install the gem by executing:
14
+
15
+ $ gem install tax_calculator_2022
16
+
17
+ ## Usage
18
+
19
+ TODO: Write usage instructions here
20
+
21
+ ## Development
22
+
23
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
24
+
25
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
26
+
27
+ ## Contributing
28
+
29
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/tax_calculator_2022.
data/Rakefile ADDED
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ task default: %i[]
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module TaxCalculator2022
4
+ VERSION = "0.1.0"
5
+ end
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "tax_calculator_2022/version"
4
+
5
+ module TaxCalculator2022
6
+ # frozen_string_literal: true
7
+
8
+ require_relative "tax_computation/version"
9
+
10
+ RANGES = {600000.0...1200000.0 => {percentage: 2.5, fixed_amount: 0, low: 600000.0},
11
+ 1200000.0...2400000.0 => {percentage: 12.5, fixed_amount: 15000, low: 1200000},
12
+ 2400000.0...3600000.0 => {percentage: 20, fixed_amount: 165000, low: 2400000},
13
+ 3600000.0...6000000.0 => {percentage: 25, fixed_amount: 405000, low: 3600000},
14
+ 6000000.0...12000000.0 => {percentage: 32.5, fixed_amount: 1005000, low: 6000000},
15
+ 12000000.0...Float::INFINITY => {percentage: 35, fixed_amount: 2955000, low: 12000000.0}
16
+ }
17
+
18
+ private
19
+
20
+ def self.calculate_monthly_tax(salary)
21
+ salary = salary * 12
22
+ if salary <= 600000.0
23
+ 0
24
+ else
25
+ calculate(salary) / 12.to_f
26
+ end
27
+ end
28
+
29
+ def self.calculate_yearly_tax(salary)
30
+ if salary <= 600000.0
31
+ 0
32
+ else
33
+ calculate(salary)
34
+ end
35
+ end
36
+
37
+ def self.calculate (salary)
38
+ range = RANGES.select{|range| range === salary}
39
+ range.values[0][:fixed_amount] + (((salary - range.values[0][:low]) / 100) * range.values[0][:percentage])
40
+ end
41
+ end
@@ -0,0 +1,4 @@
1
+ module TaxCalculator2022
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,48 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tax_calculator_2022
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - DaniyalXprolabs
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2022-07-18 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Write a longer description or delete this line.
14
+ email:
15
+ - daniyal.malik.xprolabs.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - Gemfile
21
+ - README.md
22
+ - Rakefile
23
+ - lib/tax_calculator_2022.rb
24
+ - lib/tax_calculator_2022/version.rb
25
+ - sig/tax_calculator_2022.rbs
26
+ homepage:
27
+ licenses: []
28
+ metadata: {}
29
+ post_install_message:
30
+ rdoc_options: []
31
+ require_paths:
32
+ - lib
33
+ required_ruby_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: 2.6.0
38
+ required_rubygems_version: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: '0'
43
+ requirements: []
44
+ rubygems_version: 3.3.13
45
+ signing_key:
46
+ specification_version: 4
47
+ summary: Write a short summary, because RubyGems requires one.
48
+ test_files: []