cerulean 0.14.1 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cerulean.rb +9 -1
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6ea37a4f9feea1fd9e5f2f09ee08732eb62b332b
4
- data.tar.gz: 1e6a05574ec94d4432945e240916a0f96e93aec8
3
+ metadata.gz: 158a16f764d2631111f759cbe37b6c45027035f0
4
+ data.tar.gz: df93866c6d73c33d6d9d4c1269a832cef74cbb4e
5
5
  SHA512:
6
- metadata.gz: f342b4591f6b2b87dc123c562a83e8e54c4ffa47322c29aa338d9c1e7aec33fd660b6c0fd86dc8df13466a05c9aa246e3489cbad6053968461a9b58a945cc9e4
7
- data.tar.gz: cf867681c6bb6564a627d53cd0ea47f19ecba194f021f9d1a323dce41b766afc9154b5323cc2a6824d2e6e75579ddee111b1844f5b1d37ef766e94c791e9ea2a
6
+ metadata.gz: 6515ac59370273c8eda93abfd25160dd3371510b31d5e70e1763f7d4c57fbec0ed4298258069f105bcbac491fc55cfb3d54dcee06199622e35f80118e3949d5b
7
+ data.tar.gz: 99c198a046b731cdae3388af1a9c508e40fae290f3cd9d3c2c1a94618883adcc76bc5d9711bcc9790694c22499ea89988cd2adf5a08bb9f1a297081f8bcbee58
@@ -108,6 +108,14 @@ module Cerulean
108
108
  else
109
109
  if type == String
110
110
  val
111
+ elsif type == Boolean
112
+ if val.blank? || val.downcase == 'null'
113
+ nil
114
+ elsif val.downcase == 'true'
115
+ true
116
+ else
117
+ false
118
+ end
111
119
  elsif type == Date
112
120
  Date.parse(val) rescue nil
113
121
  elsif type == DateTime
@@ -139,7 +147,7 @@ module Cerulean
139
147
  if params.has_key?(param.to_s)
140
148
  p = validate_param_type(params[param.to_s], opts[:type])
141
149
 
142
- if p.nil?
150
+ if p.nil? && opts[:null] != true
143
151
  errors[param] ||= []
144
152
  errors[param] << "#{param.to_s} is not a #{opts[:type].to_s.downcase}"
145
153
  else
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cerulean
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.1
4
+ version: 0.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kyle Kestell