tax_calculator_2022_new 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: 97e991bfea404a807c73a66123978605f1eb1ed0c5922ba3ab1edaa67801508a
4
+ data.tar.gz: e93e1456609fe43da38218ae46baab7caa5dbc2acf06c2aaaa45faba8825ffdd
5
+ SHA512:
6
+ metadata.gz: aeef8e746528766a0389cfa82487fa02052a3525138d312c6e4d197a2dfa6a6880053121d651a4882f33efc47ee17fb53dbc8c75b0ad892dc61fbda234a5c121
7
+ data.tar.gz: 306f0818c694e4816ed8031b6b9fdf516dd9923de2df6bd0d450a459ce05a51ed15a847b320ac0dc6b45f1ec282a0f4931067dc4820f3156cfd974c92bf4a7b1
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_new.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # TaxCalculator2022New
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_new`. 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_new
12
+
13
+ If bundler is not being used to manage dependencies, install the gem by executing:
14
+
15
+ $ gem install tax_calculator_2022_new
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_new.
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 TaxCalculator2022New
4
+ VERSION = "0.1.0"
5
+ end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "tax_calculator_2022_new/version"
4
+
5
+ module TaxComputation
6
+ RANGES = {600000.0...1200000.0 => {percentage: 2.5, fixed_amount: 0, low: 600000},
7
+ 1200000.0...2400000.0 => {percentage: 12.5, fixed_amount: 15000, low: 1200000},
8
+ 2400000.0...3600000.0 => {percentage: 20, fixed_amount: 165,000, low: 2400000},
9
+ 3600000.0...6000000.0 => {percentage: 25, fixed_amount: 405000, low: 3600000},
10
+ 6000000.0...12000000.0 => {percentage: 32.5, fixed_amount: 1005000, low:6000000 },
11
+ 12000000.0..Float::INFINITY => {percentage: 35, fixed_amount: 2955000, low: 12000000}
12
+ }
13
+
14
+ private
15
+
16
+ def self.calculate_monthly_tax(salary)
17
+ salary = salary * 12
18
+ if salary <= 600000.0
19
+ 0
20
+ else
21
+ calculate(salary) / 12.to_f
22
+ end
23
+ end
24
+
25
+ def self.calculate_yearly_tax(salary)
26
+ if salary <= 600000.0
27
+ 0
28
+ else
29
+ calculate(salary)
30
+ end
31
+ end
32
+
33
+ def self.calculate (salary)
34
+ range = RANGES.select{|range| range === salary}
35
+ range.values[0][:fixed_amount] + (((salary - range.values[0][:low]) / 100) * range.values[0][:percentage])
36
+ end
37
+ end
@@ -0,0 +1,4 @@
1
+ module TaxCalculator2022New
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_new
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Ikram Javad
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
+ - ikram.javad@xprolabs.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - Gemfile
21
+ - README.md
22
+ - Rakefile
23
+ - lib/tax_calculator_2022_new.rb
24
+ - lib/tax_calculator_2022_new/version.rb
25
+ - sig/tax_calculator_2022_new.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.14
45
+ signing_key:
46
+ specification_version: 4
47
+ summary: Write a short summary, because RubyGems requires one.
48
+ test_files: []