pnomolos-cart 0.0.9 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/cart/simple.rb +11 -2
  2. metadata +1 -1
data/lib/cart/simple.rb CHANGED
@@ -79,7 +79,12 @@ class Cart
79
79
 
80
80
  def update(product, count = nil)
81
81
  if (item = find(product)) && !count.nil?
82
- item.count = count
82
+ # Make sure we've got Integers. Lots of integers!
83
+ begin
84
+ item.count = count.to_i
85
+ rescue
86
+ return false
87
+ end
83
88
  end
84
89
  end
85
90
 
@@ -93,7 +98,11 @@ class Cart
93
98
 
94
99
  def quantity(product)
95
100
  if item = find(product)
96
- return item.count
101
+ # This should always be an Integer
102
+ begin
103
+ return item.count.to_i
104
+ rescue
105
+ end
97
106
  end
98
107
  return 0
99
108
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pnomolos-cart
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - botanicus