dummy-Tax 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.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/dummy_tax.rb +33 -0
  3. metadata +45 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: f954a1e87ce43bdeca3824113236f4575b5cee8a1f5b1ad83db995e5afe2a3a3
4
+ data.tar.gz: f34fb0eb5f6b067ed709e3d1a1355ed7ca417479fa47e0893b72a390ef2877cc
5
+ SHA512:
6
+ metadata.gz: 5b924df0db667f4df6f7dc3af67401c01ad3dbfc2c81357096e00ad54bf8a725a8f04c2173e88f1a37006211a11ddd71d8ad09e41294d2d06d2fd1a3b43d3850
7
+ data.tar.gz: 9b45b4652b5711255e5a14be204ff98002245ee038434536ad09db2f7bea2feb4ce914cfbb8f0d2f15e0d48d5d5c11583a8074f7e60e0389d5f728b6b631723b
data/lib/dummy_tax.rb ADDED
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ # dummy-Tax (capitalised): bracket-walk implementation.
4
+ # Benign test gem for RubyGems case-variant ingestion testing. Not malicious.
5
+ module DummyTax
6
+ VERSION = '0.1.0'
7
+
8
+ # NZ resident income tax brackets, 2024/25 (annual, NZD).
9
+ # Each entry: [upper_bound_of_band, marginal_rate].
10
+ BRACKETS = [
11
+ [14_000.0, 0.105],
12
+ [48_000.0, 0.175],
13
+ [70_000.0, 0.30],
14
+ [180_000.0, 0.33],
15
+ [Float::INFINITY, 0.39],
16
+ ].freeze
17
+
18
+ # Walk each band, taxing only the slice of income that falls inside it.
19
+ def self.income_tax(income)
20
+ raise ArgumentError, 'income must be >= 0' if income.negative?
21
+
22
+ tax = 0.0
23
+ lower = 0.0
24
+ BRACKETS.each do |upper, rate|
25
+ break if income <= lower
26
+
27
+ taxable_in_band = [income, upper].min - lower
28
+ tax += taxable_in_band * rate
29
+ lower = upper
30
+ end
31
+ tax.round(2)
32
+ end
33
+ end
metadata ADDED
@@ -0,0 +1,45 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dummy-Tax
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Mix Irving
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2026-10-01 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: 'Benign test gem: calculates NZ resident income tax by walking marginal
14
+ brackets. Used for registry testing.'
15
+ email:
16
+ - mix@socket.dev
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - lib/dummy_tax.rb
22
+ homepage: https://socket.dev
23
+ licenses:
24
+ - MIT
25
+ metadata: {}
26
+ post_install_message:
27
+ rdoc_options: []
28
+ require_paths:
29
+ - lib
30
+ required_ruby_version: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '3.0'
35
+ required_rubygems_version: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ requirements: []
41
+ rubygems_version: 3.0.3.1
42
+ signing_key:
43
+ specification_version: 4
44
+ summary: Dummy NZ income tax calculator (bracket-walk approach).
45
+ test_files: []