Sha256: 8ff6a35efc3bbddb61c676d841eaad4369bc968cc66c0904dcb71c5191cede8a

Contents?: true

Size: 403 Bytes

Versions: 5

Compression:

Stored size: 403 Bytes

Contents

class Taxedo::Tax
  attr_accessor :name, :rate
  attr_reader :id, :source_amount

  def initialize(id)
    @id = id
    @amount = 0
  end

  def amount
    @amount
  end

  def source_amount=(sa)
    @source_amount = sa
    @amount = calculate_amount
  end

  def subtotal
    @source_amount + @amount
  end

  private

  def calculate_amount
    ((@source_amount * @rate).to_f / 10000).round
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
taxedo-0.0.6 lib/taxedo/tax.rb
taxedo-0.0.5 lib/taxedo/tax.rb
taxedo-0.0.4 lib/taxedo/tax.rb
taxedo-0.0.3 lib/taxedo/tax.rb
taxedo-0.0.2 lib/taxedo/tax.rb