Sha256: fcc3d0771473dc7a1ab167a977a403f05c9b24eaa0075d9f405721146383cef9

Contents?: true

Size: 454 Bytes

Versions: 17

Compression:

Stored size: 454 Bytes

Contents

module TaxJp
  module ConsumptionTax
    @@consumption_taxes = TaxJp::Utils.load_yaml('消費税.yml')

    def rate_on(date, options = {})
      if date.is_a?(String)
        date = Date.parse(date)
      end

      ret = 0
      @@consumption_taxes.reverse_each do |start_date, rate|
        ret = rate['total']
        break if date >= start_date
      end
  
      if options[:percent]
        ret *= 100
      end
      
      ret
    end

  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
tax_jp-0.5.6 lib/tax_jp/consumption_tax.rb
tax_jp-0.5.5 lib/tax_jp/consumption_tax.rb
tax_jp-0.5.4 lib/tax_jp/consumption_tax.rb
tax_jp-0.5.3 lib/tax_jp/consumption_tax.rb
tax_jp-0.5.2 lib/tax_jp/consumption_tax.rb
tax_jp-0.5.1 lib/tax_jp/consumption_tax.rb
tax_jp-0.4.0 lib/tax_jp/consumption_tax.rb
tax_jp-0.3.13 lib/tax_jp/consumption_tax.rb
tax_jp-0.3.12 lib/tax_jp/consumption_tax.rb
tax_jp-0.3.11 lib/tax_jp/consumption_tax.rb
tax_jp-0.3.10 lib/tax_jp/consumption_tax.rb
tax_jp-0.3.9 lib/tax_jp/consumption_tax.rb
tax_jp-0.3.8 lib/tax_jp/consumption_tax.rb
tax_jp-0.3.7 lib/tax_jp/consumption_tax.rb
tax_jp-0.3.6 lib/tax_jp/consumption_tax.rb
tax_jp-0.3.5 lib/tax_jp/consumption_tax.rb
tax_jp-0.3.4 lib/tax_jp/consumption_tax.rb