cerulean 0.11.0 → 0.11.1

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cerulean.rb +22 -15
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2382ebd4159162983fe7030d8a96c3313ef26b49
4
- data.tar.gz: 33b78f3973f440a7604ab561babcd416b31d00db
3
+ metadata.gz: 446b7a960b0eb41a6d51b2c471ff779f05ffa7da
4
+ data.tar.gz: 75f361afd3940a0b10426ae3606c02c5d5c921d7
5
5
  SHA512:
6
- metadata.gz: dbd2b1d0566dabefd2d138a210b0274e5569f6b96f06d99a68a0da8c7aeb47b7e6d622a86863f11c7aad3a1733f7d78b8ca9897dcb5a35ed9429c982368dd0d4
7
- data.tar.gz: a7e2fd1e8e8cb109fdbb2b2525e620a62180f16ce8b4abe500cfdca1064c117ed47081c68fd8617651745a6930d80a4c4ba54bc9e1f6aaf21d1d58e842fb7aed
6
+ metadata.gz: ca127a24a5e24a8f4ec1f02c43579d6e9cc46cf142d46b2483c5ce8763f4fec4c5fb21e10e40a9f69e1679b69af92def837255f168df23e0cd306449cd4bb3a3
7
+ data.tar.gz: fc640993d35d867061a2391267bbf212fdc930277c99b94d7c732a380c5b2c626dc2d548f80c16d925566adc384106a25ee1123cef75252cb20f7ac7d8d6f224
@@ -133,26 +133,33 @@ module Cerulean
133
133
  if p.nil?
134
134
  errors[param] ||= []
135
135
  errors[param] << "#{param.to_s} is not a #{opts[:type].to_s.downcase}"
136
- end
136
+ else
137
+ if opts.has_key?(:min) || opts.has_key?(:max)
138
+ unless (Float(p) rescue false)
139
+ errors[param] ||= []
140
+ errors[param] << "must be a number"
141
+ end
142
+ end
137
143
 
138
- if opts.has_key?(:min)
139
- if p < opts[:min]
140
- errors[param] ||= []
141
- errors[param] << "must be greater than or equal to #{opts[:min]}"
144
+ if opts.has_key?(:min)
145
+ if p < opts[:min]
146
+ errors[param] ||= []
147
+ errors[param] << "must be greater than or equal to #{opts[:min]}"
148
+ end
142
149
  end
143
- end
144
150
 
145
- if opts.has_key?(:max)
146
- if p > opts[:max]
147
- errors[param] ||= []
148
- errors[param] << "must be less than or equal to #{opts[:max]}"
151
+ if opts.has_key?(:max)
152
+ if p > opts[:max]
153
+ errors[param] ||= []
154
+ errors[param] << "must be less than or equal to #{opts[:max]}"
155
+ end
149
156
  end
150
- end
151
157
 
152
- if opts.has_key?(:values)
153
- unless opts[:values].map { |val| val.to_s }.include?(p.to_s)
154
- errors[param] ||= []
155
- errors[param] << "must be one of #{opts[:values]}"
158
+ if opts.has_key?(:values)
159
+ unless opts[:values].map { |val| val.to_s }.include?(p.to_s)
160
+ errors[param] ||= []
161
+ errors[param] << "must be one of #{opts[:values]}"
162
+ end
156
163
  end
157
164
  end
158
165
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cerulean
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kyle Kestell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-27 00:00:00.000000000 Z
11
+ date: 2017-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: boolean