sinatra-browse 0.6 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sinatra/browse/parameter_type.rb +4 -0
- data/lib/sinatra/browse/route.rb +1 -1
- metadata +2 -3
- data/lib/sinatra/browse/validators/in.rb +0 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 384ebcd1b7b85008042e92d2e9c4b7a78b9f006f
|
4
|
+
data.tar.gz: cbb00fef429bd54edd3c5adbdb57c8f684e9f58f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd0eb333f9d40697743186ed15895917b7f32485b752feaa590f9124168e2758601ec479c69d25b7994b0ec1a84953c91f024c03fbad5585b12efc9a8f2de675
|
7
|
+
data.tar.gz: b4ae0d59dee7d1fb5a2dbc9d49ea19f0ae316d683cb3fb183a8b06ed23de36eea45bbf18c013dfa48d3491d254e3822132588b9cc76344ad2a9789b5ce96ef9a
|
data/lib/sinatra/browse/route.rb
CHANGED
@@ -40,7 +40,7 @@ module Sinatra::Browse
|
|
40
40
|
@param_declarations.each do |name, pd|
|
41
41
|
name = name.to_s # The params hash uses strings but declarations use symbols
|
42
42
|
|
43
|
-
params[name] ||= pd.default
|
43
|
+
params[name] ||= pd.default if pd.default_set?
|
44
44
|
|
45
45
|
# We specifically check for nil here since a boolean's default can be false
|
46
46
|
if params[name].nil?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sinatra-browse
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Axsh Co. LTD
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-07-07 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Parameter declaration framework and browsable API for Sinatra
|
14
14
|
email: dev@axsh.net
|
@@ -22,7 +22,6 @@ files:
|
|
22
22
|
- lib/sinatra/browse/erb_templates/html.erb
|
23
23
|
- lib/sinatra/browse/parameter_type.rb
|
24
24
|
- lib/sinatra/browse/errors.rb
|
25
|
-
- lib/sinatra/browse/validators/in.rb
|
26
25
|
- lib/sinatra/browse/route.rb
|
27
26
|
- lib/sinatra/browse/parameter_types/min_max.rb
|
28
27
|
- lib/sinatra/browse/parameter_types/float.rb
|
@@ -1,25 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
|
3
|
-
module Sinatra::Browse
|
4
|
-
module Validators
|
5
|
-
class In < Validator
|
6
|
-
class InvalidFormat < Exception; end
|
7
|
-
class UnableToCoerce < Exception; end
|
8
|
-
|
9
|
-
def intialize(parameter_type, criteria)
|
10
|
-
if ! criteria.respond_to?(:each)
|
11
|
-
raise InvalidFormat, "#{criteria} does not have an .each method. " +
|
12
|
-
"Can't be used for 'in'."
|
13
|
-
end
|
14
|
-
|
15
|
-
criteria.map!
|
16
|
-
|
17
|
-
super(parameter_type, criteria)
|
18
|
-
end
|
19
|
-
|
20
|
-
def _validate
|
21
|
-
@criteria.member?(@value)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|