stamp_duty 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 +7 -0
 - data/.gitignore +9 -0
 - data/.travis.yml +4 -0
 - data/Gemfile +4 -0
 - data/LICENSE.txt +21 -0
 - data/README.md +71 -0
 - data/Rakefile +10 -0
 - data/bin/console +14 -0
 - data/bin/setup +8 -0
 - data/lib/stamp_duty/band.rb +31 -0
 - data/lib/stamp_duty/band_amount.rb +24 -0
 - data/lib/stamp_duty/band_selector.rb +35 -0
 - data/lib/stamp_duty/residential_calculator.rb +32 -0
 - data/lib/stamp_duty/version.rb +3 -0
 - data/lib/stamp_duty.rb +14 -0
 - data/stamp_duty.gemspec +28 -0
 - metadata +143 -0
 
    
        checksums.yaml
    ADDED
    
    | 
         @@ -0,0 +1,7 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ---
         
     | 
| 
      
 2 
     | 
    
         
            +
            SHA1:
         
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 1147690e21ebe12467c191b40afbd6f29e4c4c90
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 63fe7bd8fabb23dc64f76c71d030b821b3a7a765
         
     | 
| 
      
 5 
     | 
    
         
            +
            SHA512:
         
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: dfaed9758a2773e05453e368f6d97a244350203973256c2f849acbb6315f802373420690cd025ea68d424f01e3db41ac3e9915fe8ba04b35b7fec8fd3a22611a
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 26763a41182056a87a64a2fbeeae8187b3341504bad4d74113680f9141d75b91fbaf9c11c8f41c165d5ca318e288d74711a39498ced0ccd30d6464d9ce17ba31
         
     | 
    
        data/.gitignore
    ADDED
    
    
    
        data/.travis.yml
    ADDED
    
    
    
        data/Gemfile
    ADDED
    
    
    
        data/LICENSE.txt
    ADDED
    
    | 
         @@ -0,0 +1,21 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            The MIT License (MIT)
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            Copyright (c) 2016 James Doyley
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            Permission is hereby granted, free of charge, to any person obtaining a copy
         
     | 
| 
      
 6 
     | 
    
         
            +
            of this software and associated documentation files (the "Software"), to deal
         
     | 
| 
      
 7 
     | 
    
         
            +
            in the Software without restriction, including without limitation the rights
         
     | 
| 
      
 8 
     | 
    
         
            +
            to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         
     | 
| 
      
 9 
     | 
    
         
            +
            copies of the Software, and to permit persons to whom the Software is
         
     | 
| 
      
 10 
     | 
    
         
            +
            furnished to do so, subject to the following conditions:
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            The above copyright notice and this permission notice shall be included in
         
     | 
| 
      
 13 
     | 
    
         
            +
            all copies or substantial portions of the Software.
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         
     | 
| 
      
 16 
     | 
    
         
            +
            IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         
     | 
| 
      
 17 
     | 
    
         
            +
            FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         
     | 
| 
      
 18 
     | 
    
         
            +
            AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         
     | 
| 
      
 19 
     | 
    
         
            +
            LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         
     | 
| 
      
 20 
     | 
    
         
            +
            OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
         
     | 
| 
      
 21 
     | 
    
         
            +
            THE SOFTWARE.
         
     | 
    
        data/README.md
    ADDED
    
    | 
         @@ -0,0 +1,71 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # StampDuty
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            StampDuty is a stamp duty calculator for the UK property market.  Currently only
         
     | 
| 
      
 4 
     | 
    
         
            +
            for residential property, and doesn't include the extra 3% for owning multiple properties
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            ## Installation
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
            Add this line to your application's Gemfile:
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 11 
     | 
    
         
            +
            gem 'stamp_duty'
         
     | 
| 
      
 12 
     | 
    
         
            +
            ```
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
            And then execute:
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                $ bundle
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            Or install it yourself as:
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                $ gem install stamp_duty
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
            ## Usage
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 25 
     | 
    
         
            +
            calc = StampDuty.for(275000)
         
     | 
| 
      
 26 
     | 
    
         
            +
            calc.calculate
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
            # .to_s("F") as returns a big decimal
         
     | 
| 
      
 29 
     | 
    
         
            +
            calc.stamp_duty.to_s("F") # => 3750.0
         
     | 
| 
      
 30 
     | 
    
         
            +
            ```
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
            You can also can get each the amount in each band
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 35 
     | 
    
         
            +
            calc.band_amounts.each do |ba|
         
     | 
| 
      
 36 
     | 
    
         
            +
             puts ba.description
         
     | 
| 
      
 37 
     | 
    
         
            +
             puts ba.amount.to_s("F")
         
     | 
| 
      
 38 
     | 
    
         
            +
             puts ba.percentage_rate
         
     | 
| 
      
 39 
     | 
    
         
            +
            end
         
     | 
| 
      
 40 
     | 
    
         
            +
            ```
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
            Which would return
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
            Up to 125,000  
         
     | 
| 
      
 45 
     | 
    
         
            +
            0.0  
         
     | 
| 
      
 46 
     | 
    
         
            +
            0
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
            Above 125,000 and up to 250,000  
         
     | 
| 
      
 49 
     | 
    
         
            +
            2500.0  
         
     | 
| 
      
 50 
     | 
    
         
            +
            2
         
     | 
| 
      
 51 
     | 
    
         
            +
             
     | 
| 
      
 52 
     | 
    
         
            +
            Above 250,000 and up to 925,000  
         
     | 
| 
      
 53 
     | 
    
         
            +
            1250.0  
         
     | 
| 
      
 54 
     | 
    
         
            +
            5
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
      
 57 
     | 
    
         
            +
            ## Development
         
     | 
| 
      
 58 
     | 
    
         
            +
             
     | 
| 
      
 59 
     | 
    
         
            +
            After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
         
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
| 
      
 61 
     | 
    
         
            +
            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 tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
         
     | 
| 
      
 62 
     | 
    
         
            +
             
     | 
| 
      
 63 
     | 
    
         
            +
            ## Contributing
         
     | 
| 
      
 64 
     | 
    
         
            +
             
     | 
| 
      
 65 
     | 
    
         
            +
            Bug reports and pull requests are welcome on GitHub at https://github.com/jdexx/stamp_duty.
         
     | 
| 
      
 66 
     | 
    
         
            +
             
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
      
 68 
     | 
    
         
            +
            ## License
         
     | 
| 
      
 69 
     | 
    
         
            +
             
     | 
| 
      
 70 
     | 
    
         
            +
            The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
         
     | 
| 
      
 71 
     | 
    
         
            +
             
     | 
    
        data/Rakefile
    ADDED
    
    
    
        data/bin/console
    ADDED
    
    | 
         @@ -0,0 +1,14 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            #!/usr/bin/env ruby
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require "bundler/setup"
         
     | 
| 
      
 4 
     | 
    
         
            +
            require "stamp_duty"
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            # You can add fixtures and/or initialization code here to make experimenting
         
     | 
| 
      
 7 
     | 
    
         
            +
            # with your gem easier. You can also use a different console, if you like.
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            # (If you use this, don't forget to add pry to your Gemfile!)
         
     | 
| 
      
 10 
     | 
    
         
            +
            # require "pry"
         
     | 
| 
      
 11 
     | 
    
         
            +
            # Pry.start
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            require "irb"
         
     | 
| 
      
 14 
     | 
    
         
            +
            IRB.start
         
     | 
    
        data/bin/setup
    ADDED
    
    
| 
         @@ -0,0 +1,31 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module StampDuty
         
     | 
| 
      
 2 
     | 
    
         
            +
              class Band
         
     | 
| 
      
 3 
     | 
    
         
            +
                attr_reader :lower_bound, :upper_bound, :percentage_rate
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
                def initialize(lower_bound, upper_bound, percentage_rate)
         
     | 
| 
      
 6 
     | 
    
         
            +
                  @lower_bound = lower_bound
         
     | 
| 
      
 7 
     | 
    
         
            +
                  @upper_bound = upper_bound
         
     | 
| 
      
 8 
     | 
    
         
            +
                  @percentage_rate = percentage_rate
         
     | 
| 
      
 9 
     | 
    
         
            +
                end
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                def description
         
     | 
| 
      
 12 
     | 
    
         
            +
                  return "Up to #{ formatted_upper_bound }" if lower_bound.zero?
         
     | 
| 
      
 13 
     | 
    
         
            +
                  return "Above #{ formatted_lower_bound }+" if upper_bound.nil?
         
     | 
| 
      
 14 
     | 
    
         
            +
                  "Above #{ formatted_lower_bound } and up to #{ formatted_upper_bound }"
         
     | 
| 
      
 15 
     | 
    
         
            +
                end
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                def decimal_percentage_rate
         
     | 
| 
      
 18 
     | 
    
         
            +
                  percentage_rate.to_d / 100
         
     | 
| 
      
 19 
     | 
    
         
            +
                end
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                private
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                def formatted_lower_bound
         
     | 
| 
      
 24 
     | 
    
         
            +
                  lower_bound.to_s.reverse.scan(/\d{1,3}/).join(",").reverse
         
     | 
| 
      
 25 
     | 
    
         
            +
                end
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
                def formatted_upper_bound
         
     | 
| 
      
 28 
     | 
    
         
            +
                  upper_bound.to_s.reverse.scan(/\d{1,3}/).join(",").reverse
         
     | 
| 
      
 29 
     | 
    
         
            +
                end
         
     | 
| 
      
 30 
     | 
    
         
            +
              end
         
     | 
| 
      
 31 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,24 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module StampDuty
         
     | 
| 
      
 2 
     | 
    
         
            +
              class BandAmount
         
     | 
| 
      
 3 
     | 
    
         
            +
                extend Forwardable
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
                def_delegators :@band, :lower_bound, :percentage_rate, :decimal_percentage_rate, :description
         
     | 
| 
      
 6 
     | 
    
         
            +
                attr_reader :price, :band
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
                def initialize(price:, band:)
         
     | 
| 
      
 9 
     | 
    
         
            +
                  @price = price
         
     | 
| 
      
 10 
     | 
    
         
            +
                  @band = band
         
     | 
| 
      
 11 
     | 
    
         
            +
                end
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                def amount
         
     | 
| 
      
 14 
     | 
    
         
            +
                  @amount ||= decimal_percentage_rate * rateable_amount
         
     | 
| 
      
 15 
     | 
    
         
            +
                end
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                private
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                def rateable_amount
         
     | 
| 
      
 20 
     | 
    
         
            +
                  @rateable_amount ||= price - lower_bound
         
     | 
| 
      
 21 
     | 
    
         
            +
                end
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
              end
         
     | 
| 
      
 24 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,35 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module StampDuty
         
     | 
| 
      
 2 
     | 
    
         
            +
              class BandSelector
         
     | 
| 
      
 3 
     | 
    
         
            +
                BAND_DATA = [
         
     | 
| 
      
 4 
     | 
    
         
            +
                  { lower_bound: 0, upper_bound: 125000, percentage_rate: 0 },
         
     | 
| 
      
 5 
     | 
    
         
            +
                  { lower_bound: 125000, upper_bound: 250000, percentage_rate: 2 },
         
     | 
| 
      
 6 
     | 
    
         
            +
                  { lower_bound: 250000, upper_bound: 925000, percentage_rate: 5 },
         
     | 
| 
      
 7 
     | 
    
         
            +
                  { lower_bound: 925000, upper_bound: 1500000, percentage_rate: 10 },
         
     | 
| 
      
 8 
     | 
    
         
            +
                  { lower_bound: 1500000, percentage_rate: 12 }
         
     | 
| 
      
 9 
     | 
    
         
            +
                ]
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                attr_reader :price
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                def initialize(price)
         
     | 
| 
      
 14 
     | 
    
         
            +
                  @price = price
         
     | 
| 
      
 15 
     | 
    
         
            +
                end
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                def bands
         
     | 
| 
      
 18 
     | 
    
         
            +
                  sorted_band_data.map{ |band_data| build_band(band_data) }
         
     | 
| 
      
 19 
     | 
    
         
            +
                end
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                private
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                def build_band(band_data)
         
     | 
| 
      
 24 
     | 
    
         
            +
                  StampDuty::Band.new(band_data[:lower_bound], band_data[:upper_bound], band_data[:percentage_rate])
         
     | 
| 
      
 25 
     | 
    
         
            +
                end
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
                def sorted_band_data
         
     | 
| 
      
 28 
     | 
    
         
            +
                  band_data_for_price.sort_by{ |band| band[:lower_band] }.reverse!
         
     | 
| 
      
 29 
     | 
    
         
            +
                end
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
      
 31 
     | 
    
         
            +
                def band_data_for_price
         
     | 
| 
      
 32 
     | 
    
         
            +
                  BAND_DATA.select{ |band| price > band[:lower_bound] }
         
     | 
| 
      
 33 
     | 
    
         
            +
                end
         
     | 
| 
      
 34 
     | 
    
         
            +
              end
         
     | 
| 
      
 35 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,32 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module StampDuty
         
     | 
| 
      
 2 
     | 
    
         
            +
              class ResidentialCalculator
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
                attr_reader :purchase_price, :band_amounts, :bands
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
                def initialize(purchase_price, bands)
         
     | 
| 
      
 7 
     | 
    
         
            +
                  @purchase_price = purchase_price.to_d
         
     | 
| 
      
 8 
     | 
    
         
            +
                  @bands = bands
         
     | 
| 
      
 9 
     | 
    
         
            +
                  @band_amounts = []
         
     | 
| 
      
 10 
     | 
    
         
            +
                end
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                def stamp_duty
         
     | 
| 
      
 13 
     | 
    
         
            +
                  band_amounts.map(&:amount).reduce(0, :+)
         
     | 
| 
      
 14 
     | 
    
         
            +
                end
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                def calculate
         
     | 
| 
      
 17 
     | 
    
         
            +
                  price = purchase_price
         
     | 
| 
      
 18 
     | 
    
         
            +
                  while price > 0
         
     | 
| 
      
 19 
     | 
    
         
            +
                    bands.each do |band|
         
     | 
| 
      
 20 
     | 
    
         
            +
                      add_band_amount(band, price)
         
     | 
| 
      
 21 
     | 
    
         
            +
                      price = band.lower_bound
         
     | 
| 
      
 22 
     | 
    
         
            +
                    end
         
     | 
| 
      
 23 
     | 
    
         
            +
                  end
         
     | 
| 
      
 24 
     | 
    
         
            +
                end
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                private
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
                def add_band_amount(band, price)
         
     | 
| 
      
 29 
     | 
    
         
            +
                  @band_amounts.unshift(StampDuty::BandAmount.new(price: price, band: band))
         
     | 
| 
      
 30 
     | 
    
         
            +
                end
         
     | 
| 
      
 31 
     | 
    
         
            +
              end
         
     | 
| 
      
 32 
     | 
    
         
            +
            end
         
     | 
    
        data/lib/stamp_duty.rb
    ADDED
    
    | 
         @@ -0,0 +1,14 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require "bigdecimal"
         
     | 
| 
      
 2 
     | 
    
         
            +
            require "bigdecimal/util"
         
     | 
| 
      
 3 
     | 
    
         
            +
            require "stamp_duty/version"
         
     | 
| 
      
 4 
     | 
    
         
            +
            require "stamp_duty/band"
         
     | 
| 
      
 5 
     | 
    
         
            +
            require "stamp_duty/band_selector"
         
     | 
| 
      
 6 
     | 
    
         
            +
            require "stamp_duty/band_amount"
         
     | 
| 
      
 7 
     | 
    
         
            +
            require "stamp_duty/residential_calculator"
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            module StampDuty
         
     | 
| 
      
 10 
     | 
    
         
            +
              def self.for(price)
         
     | 
| 
      
 11 
     | 
    
         
            +
                bands = StampDuty::BandSelector.new(price).bands
         
     | 
| 
      
 12 
     | 
    
         
            +
                StampDuty::ResidentialCalculator.new(price, bands)
         
     | 
| 
      
 13 
     | 
    
         
            +
              end
         
     | 
| 
      
 14 
     | 
    
         
            +
            end
         
     | 
    
        data/stamp_duty.gemspec
    ADDED
    
    | 
         @@ -0,0 +1,28 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # coding: utf-8
         
     | 
| 
      
 2 
     | 
    
         
            +
            lib = File.expand_path('../lib', __FILE__)
         
     | 
| 
      
 3 
     | 
    
         
            +
            $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'stamp_duty/version'
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            Gem::Specification.new do |spec|
         
     | 
| 
      
 7 
     | 
    
         
            +
              spec.name          = "stamp_duty"
         
     | 
| 
      
 8 
     | 
    
         
            +
              spec.version       = StampDuty::VERSION
         
     | 
| 
      
 9 
     | 
    
         
            +
              spec.authors       = ["James Doyley"]
         
     | 
| 
      
 10 
     | 
    
         
            +
              spec.email         = ["jdoyley@gmail.com"]
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
              spec.summary       = %q{ A UK proerty stamp duty calculator }
         
     | 
| 
      
 13 
     | 
    
         
            +
              spec.homepage      = "https://github.com/j-dexx/stamp_duty"
         
     | 
| 
      
 14 
     | 
    
         
            +
              spec.license       = "MIT"
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
              spec.files         = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
         
     | 
| 
      
 17 
     | 
    
         
            +
              spec.bindir        = "exe"
         
     | 
| 
      
 18 
     | 
    
         
            +
              spec.executables   = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
         
     | 
| 
      
 19 
     | 
    
         
            +
              spec.require_paths = ["lib"]
         
     | 
| 
      
 20 
     | 
    
         
            +
              spec.required_ruby_version = "~> 2.1"
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
              spec.add_development_dependency "bundler", "~> 1.11"
         
     | 
| 
      
 23 
     | 
    
         
            +
              spec.add_development_dependency "rake", "~> 10.0"
         
     | 
| 
      
 24 
     | 
    
         
            +
              spec.add_development_dependency "minitest", "~> 5.0"
         
     | 
| 
      
 25 
     | 
    
         
            +
              spec.add_development_dependency "simplecov", "~> 0.11.2"
         
     | 
| 
      
 26 
     | 
    
         
            +
              spec.add_development_dependency "mocha", "~> 1.1.0"
         
     | 
| 
      
 27 
     | 
    
         
            +
              spec.add_development_dependency "pry"
         
     | 
| 
      
 28 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    ADDED
    
    | 
         @@ -0,0 +1,143 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification
         
     | 
| 
      
 2 
     | 
    
         
            +
            name: stamp_duty
         
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.1.0
         
     | 
| 
      
 5 
     | 
    
         
            +
            platform: ruby
         
     | 
| 
      
 6 
     | 
    
         
            +
            authors:
         
     | 
| 
      
 7 
     | 
    
         
            +
            - James Doyley
         
     | 
| 
      
 8 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
      
 9 
     | 
    
         
            +
            bindir: exe
         
     | 
| 
      
 10 
     | 
    
         
            +
            cert_chain: []
         
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2016-04-27 00:00:00.000000000 Z
         
     | 
| 
      
 12 
     | 
    
         
            +
            dependencies:
         
     | 
| 
      
 13 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 14 
     | 
    
         
            +
              name: bundler
         
     | 
| 
      
 15 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 16 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 17 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 18 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 19 
     | 
    
         
            +
                    version: '1.11'
         
     | 
| 
      
 20 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 21 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 22 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 23 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 24 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 25 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 26 
     | 
    
         
            +
                    version: '1.11'
         
     | 
| 
      
 27 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 28 
     | 
    
         
            +
              name: rake
         
     | 
| 
      
 29 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 30 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 31 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 32 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 33 
     | 
    
         
            +
                    version: '10.0'
         
     | 
| 
      
 34 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 35 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 36 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 37 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 38 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 39 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 40 
     | 
    
         
            +
                    version: '10.0'
         
     | 
| 
      
 41 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 42 
     | 
    
         
            +
              name: minitest
         
     | 
| 
      
 43 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 44 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 45 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 46 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 47 
     | 
    
         
            +
                    version: '5.0'
         
     | 
| 
      
 48 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 49 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 50 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 51 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 52 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 53 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 54 
     | 
    
         
            +
                    version: '5.0'
         
     | 
| 
      
 55 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 56 
     | 
    
         
            +
              name: simplecov
         
     | 
| 
      
 57 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 58 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 59 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 60 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 61 
     | 
    
         
            +
                    version: 0.11.2
         
     | 
| 
      
 62 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 63 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 64 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 65 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 66 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 67 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 68 
     | 
    
         
            +
                    version: 0.11.2
         
     | 
| 
      
 69 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 70 
     | 
    
         
            +
              name: mocha
         
     | 
| 
      
 71 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 72 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 73 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 74 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 75 
     | 
    
         
            +
                    version: 1.1.0
         
     | 
| 
      
 76 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 77 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 78 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 79 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 80 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 81 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 82 
     | 
    
         
            +
                    version: 1.1.0
         
     | 
| 
      
 83 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 84 
     | 
    
         
            +
              name: pry
         
     | 
| 
      
 85 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 86 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 87 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 88 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 89 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 90 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 91 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 92 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 93 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 94 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 95 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 96 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 97 
     | 
    
         
            +
            description: 
         
     | 
| 
      
 98 
     | 
    
         
            +
            email:
         
     | 
| 
      
 99 
     | 
    
         
            +
            - jdoyley@gmail.com
         
     | 
| 
      
 100 
     | 
    
         
            +
            executables: []
         
     | 
| 
      
 101 
     | 
    
         
            +
            extensions: []
         
     | 
| 
      
 102 
     | 
    
         
            +
            extra_rdoc_files: []
         
     | 
| 
      
 103 
     | 
    
         
            +
            files:
         
     | 
| 
      
 104 
     | 
    
         
            +
            - ".gitignore"
         
     | 
| 
      
 105 
     | 
    
         
            +
            - ".travis.yml"
         
     | 
| 
      
 106 
     | 
    
         
            +
            - Gemfile
         
     | 
| 
      
 107 
     | 
    
         
            +
            - LICENSE.txt
         
     | 
| 
      
 108 
     | 
    
         
            +
            - README.md
         
     | 
| 
      
 109 
     | 
    
         
            +
            - Rakefile
         
     | 
| 
      
 110 
     | 
    
         
            +
            - bin/console
         
     | 
| 
      
 111 
     | 
    
         
            +
            - bin/setup
         
     | 
| 
      
 112 
     | 
    
         
            +
            - lib/stamp_duty.rb
         
     | 
| 
      
 113 
     | 
    
         
            +
            - lib/stamp_duty/band.rb
         
     | 
| 
      
 114 
     | 
    
         
            +
            - lib/stamp_duty/band_amount.rb
         
     | 
| 
      
 115 
     | 
    
         
            +
            - lib/stamp_duty/band_selector.rb
         
     | 
| 
      
 116 
     | 
    
         
            +
            - lib/stamp_duty/residential_calculator.rb
         
     | 
| 
      
 117 
     | 
    
         
            +
            - lib/stamp_duty/version.rb
         
     | 
| 
      
 118 
     | 
    
         
            +
            - stamp_duty.gemspec
         
     | 
| 
      
 119 
     | 
    
         
            +
            homepage: https://github.com/j-dexx/stamp_duty
         
     | 
| 
      
 120 
     | 
    
         
            +
            licenses:
         
     | 
| 
      
 121 
     | 
    
         
            +
            - MIT
         
     | 
| 
      
 122 
     | 
    
         
            +
            metadata: {}
         
     | 
| 
      
 123 
     | 
    
         
            +
            post_install_message: 
         
     | 
| 
      
 124 
     | 
    
         
            +
            rdoc_options: []
         
     | 
| 
      
 125 
     | 
    
         
            +
            require_paths:
         
     | 
| 
      
 126 
     | 
    
         
            +
            - lib
         
     | 
| 
      
 127 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 128 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 129 
     | 
    
         
            +
              - - "~>"
         
     | 
| 
      
 130 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 131 
     | 
    
         
            +
                  version: '2.1'
         
     | 
| 
      
 132 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 133 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 134 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 135 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 136 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 137 
     | 
    
         
            +
            requirements: []
         
     | 
| 
      
 138 
     | 
    
         
            +
            rubyforge_project: 
         
     | 
| 
      
 139 
     | 
    
         
            +
            rubygems_version: 2.5.1
         
     | 
| 
      
 140 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
      
 141 
     | 
    
         
            +
            specification_version: 4
         
     | 
| 
      
 142 
     | 
    
         
            +
            summary: A UK proerty stamp duty calculator
         
     | 
| 
      
 143 
     | 
    
         
            +
            test_files: []
         
     |