friendly_routes 0.4.0 → 0.4.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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e72b84173e2bf1383042a2feda7605f63cec246
|
4
|
+
data.tar.gz: 42589d7a55fb9e067265d305fa1dbdbd83fe6d24
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c16dbcf2533f90de49de5636336f0e89f7c1d50d7f28aa68b3266eabdc93e4252b04d48f5c0074a7c4277ef551d2525909e92aae5a623dc72356835229a5699
|
7
|
+
data.tar.gz: 39e011306c64d601a9c70a2da3d8a2dcd4469fbc81dc767c65affa1fc38e7fc7cfce7505039dff9ffd47e9e21d93f6006b936d37caafce3056359ea0b546292d
|
@@ -22,21 +22,21 @@ module FriendlyRoutes
|
|
22
22
|
# @param [String] value request value
|
23
23
|
# @return [Boolean]
|
24
24
|
def parse(value)
|
25
|
-
value == @true
|
25
|
+
(value == @true).to_s
|
26
26
|
end
|
27
27
|
|
28
28
|
# (see Base#compose)
|
29
|
-
# @param [Boolean] value
|
29
|
+
# @param [Boolean, String] value boolean, or "True"/"False" strings
|
30
30
|
# @return [String] request value
|
31
31
|
def compose(value)
|
32
|
-
value ? @true : @false
|
32
|
+
value == true || value == 'true' ? @true : @false
|
33
33
|
end
|
34
34
|
|
35
35
|
# (see Base#allowed?)
|
36
|
-
# @param [Boolean] value
|
36
|
+
# @param [Boolean, String] value boolean, or "True"/"False" strings
|
37
37
|
# @return [Boolean]
|
38
38
|
def allowed?(value)
|
39
|
-
[true, false].include? value
|
39
|
+
[true, false, 'true', 'false'].include? value
|
40
40
|
end
|
41
41
|
|
42
42
|
private
|
@@ -10,6 +10,9 @@ module FriendlyRoutes
|
|
10
10
|
super(:collection, name, optional)
|
11
11
|
@hash = hash
|
12
12
|
check_params
|
13
|
+
@hash = @hash.map do |k, v|
|
14
|
+
[k, v.try(:to_s) || v]
|
15
|
+
end.to_h
|
13
16
|
end
|
14
17
|
|
15
18
|
def constraints
|
@@ -27,14 +30,14 @@ module FriendlyRoutes
|
|
27
30
|
# @param [Object] value hash value
|
28
31
|
# @return [String, Symbol] hash key
|
29
32
|
def compose(value)
|
30
|
-
@hash.key(value)
|
33
|
+
@hash.key(value) || @hash.key(value.try(:to_s))
|
31
34
|
end
|
32
35
|
|
33
36
|
# (see Base#allowed?)
|
34
|
-
# @param [
|
37
|
+
# @param [Object] value hash value
|
35
38
|
# @return [Boolean]
|
36
39
|
def allowed?(value)
|
37
|
-
@hash.values.include?(value)
|
40
|
+
@hash.values.include?(value) || @hash.values.include?(value.try(:to_s))
|
38
41
|
end
|
39
42
|
|
40
43
|
private
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: friendly_routes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roman Gritsay
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-10-
|
11
|
+
date: 2016-10-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|