rack-param 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rack/param.rb +13 -9
- data/rack-param.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba04656ba303a1a216387553f0cf6db3e70d616e
|
4
|
+
data.tar.gz: 770275431e757b4ebe6530b4632b225302656c25
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41c0ab7e6907d9890f38ba72442bce6112230f5ab8837b0ccbe566cde5dce478a4a38279fc3505a2eb66d1555ba91bebec48ac38eb7e75aa5a23e800547d24d8
|
7
|
+
data.tar.gz: 4f55ca7bbb61cddf6dfcadb153a4212315fd3e201a3415b6971f2ed7ca69d29f0d64e075cd43df73d6676458869175303ccd559c69ebdb051f16dd4d018861fd
|
data/lib/rack/param.rb
CHANGED
@@ -28,15 +28,17 @@ module Rack
|
|
28
28
|
def param name, type, opts={}
|
29
29
|
_name = name.to_s
|
30
30
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
31
|
+
if params_original.member? _name
|
32
|
+
p = Rack::Parameter.new(
|
33
|
+
:name => _name,
|
34
|
+
:value => params_original[_name] || params[_name],
|
35
|
+
:type => type,
|
36
|
+
:conditions => opts
|
37
|
+
)
|
37
38
|
|
38
|
-
|
39
|
-
|
39
|
+
raise ParameterError, p.error unless p.valid?
|
40
|
+
params[_name] = p.value
|
41
|
+
end
|
40
42
|
end
|
41
43
|
end
|
42
44
|
|
@@ -93,7 +95,9 @@ module Rack
|
|
93
95
|
def process opts
|
94
96
|
return "Parameter #{@name} is required." if @value.nil? && required?
|
95
97
|
|
96
|
-
|
98
|
+
puts "VALUE for (#{@name}): " + @value.inspect
|
99
|
+
|
100
|
+
unless @value.class == @type || @value.nil?
|
97
101
|
begin
|
98
102
|
@value = case @type.to_s.downcase.to_sym
|
99
103
|
when :date then Date.parse @value
|
data/rack-param.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = "rack-param"
|
7
|
-
spec.version = "0.1.
|
7
|
+
spec.version = "0.1.5"
|
8
8
|
spec.authors = ["Nathaniel Symer"]
|
9
9
|
spec.email = ["nate@natesymer.com"]
|
10
10
|
spec.summary = "Sane parameter validation for Rack::Request."
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-param
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathaniel Symer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -76,7 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
76
76
|
version: '0'
|
77
77
|
requirements: []
|
78
78
|
rubyforge_project:
|
79
|
-
rubygems_version: 2.
|
79
|
+
rubygems_version: 2.4.5
|
80
80
|
signing_key:
|
81
81
|
specification_version: 4
|
82
82
|
summary: Sane parameter validation for Rack::Request.
|