calculatediscount 0.0.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/lib/calculatediscount.rb +24 -0
- metadata +43 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 5aa6d6583b534a20986f79f2f779359978105e9a
|
4
|
+
data.tar.gz: c84f0bd7d53a97d1ee58758f667986e8b9e55323
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 93ba3865fe1b535a09bce7bf1d8daaa3f6d88d68d375f35539bacf4dcd180c9a6cb3122bea07b7ca3dd9f9837349aa41ab41559b3594ccc8265bff11657976eb
|
7
|
+
data.tar.gz: f6108a7707052ccead0407cbaeac328f6903e31163d9e281399081257d1b80734f333c92ff40237ae79f7807d392e05b497bf5f884691c76164c3a60cd924ff1
|
@@ -0,0 +1,24 @@
|
|
1
|
+
class Discount
|
2
|
+
def self.calulate(name, total)
|
3
|
+
@category =
|
4
|
+
{
|
5
|
+
"NCI" => 0.4,
|
6
|
+
"Student" => 0.3,
|
7
|
+
"Christmas" => 0.5,
|
8
|
+
"FirsttimeVisitor" => 0.1,
|
9
|
+
"Other" => 0.5
|
10
|
+
}
|
11
|
+
if @category.has_key?("#{name}") then
|
12
|
+
value = @category["#{name}"]
|
13
|
+
discount = total * value
|
14
|
+
net = total - discount
|
15
|
+
return net
|
16
|
+
else
|
17
|
+
#puts "No Discounts for this Category"
|
18
|
+
return total
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
|
metadata
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: calculatediscount
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Mamta
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-11-23 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: A simple gem
|
14
|
+
email: mamta@email.ie
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/calculatediscount.rb
|
20
|
+
homepage: ''
|
21
|
+
licenses: []
|
22
|
+
metadata: {}
|
23
|
+
post_install_message:
|
24
|
+
rdoc_options: []
|
25
|
+
require_paths:
|
26
|
+
- lib
|
27
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
28
|
+
requirements:
|
29
|
+
- - ">="
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: '0'
|
32
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
33
|
+
requirements:
|
34
|
+
- - ">="
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '0'
|
37
|
+
requirements: []
|
38
|
+
rubyforge_project:
|
39
|
+
rubygems_version: 2.2.2
|
40
|
+
signing_key:
|
41
|
+
specification_version: 4
|
42
|
+
summary: Test to calculate the discount!
|
43
|
+
test_files: []
|