Skip to content

Latest commit

 

History

History
14 lines (12 loc) · 654 Bytes

README.rdoc

File metadata and controls

14 lines (12 loc) · 654 Bytes

Sample app to show some basic OOP in Ruby

This app generates a sales receipt with taxes for each type of product. The output can be displayed by running the spec receipt_spec.rb

  • The app uses Ruby 1.9.3 and bundler (Gemfile). You need to run “bundle install” to install rSpec gem

  • The spec file is receipt_spec.rb which you can run with: “rspec receipt_spec.rb”

  • The main class is Product which calculates common taxes.

  • There are subclasses of Product to indicate those who don’t need the basic sales tax. They include a module which sets this tax to zero.

  • The Receipt class calculates the output based on elements of LineItem class