Module: Taxedo
- Defined in:
- lib/taxedo.rb,
lib/taxedo/implants.rb
Defined Under Namespace
Modules: Builder, Implants
Classes: Receipt, Region, Tax
Class Method Summary
collapse
Class Method Details
.base_data_path ⇒ Object
6
7
8
|
# File 'lib/taxedo.rb', line 6
def self.base_data_path
base_path 'data'
end
|
.base_languages_path ⇒ Object
10
11
12
|
# File 'lib/taxedo.rb', line 10
def self.base_languages_path
base_path 'languages'
end
|
.base_path(name) ⇒ Object
2
3
4
|
# File 'lib/taxedo.rb', line 2
def self.base_path(name)
File.expand_path("../../#{name}", __FILE__) + '/'
end
|
.region(region_id) ⇒ Object
14
15
16
|
# File 'lib/taxedo.rb', line 14
def self.region(region_id)
Taxedo::Region.new(region_id)
end
|
.tax_for(region_id, amount, options = {}) ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/taxedo.rb', line 18
def self.tax_for(region_id, amount, options={})
options = { format: :text, on: Time.now, rule: 'standard', html_options: {} }.merge(options)
receipt = Taxedo.region(region_id).calculate(amount, on: options[:on], rule: options[:rule])
return case options[:format]
when :hash then receipt.to_hash
when :html then receipt.to_html options[:html_options]
when :json then receipt.to_json
else receipt.to_text
end
end
|