rails_param 0.0.2 → 0.0.3
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 +4 -4
- data/README.md +2 -2
- data/lib/rails_param/param.rb +1 -1
- data/lib/rails_param/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 62719118e57a8eed3bd8b7cc8ff2f095d8e4dc73
|
|
4
|
+
data.tar.gz: da4a112bbd5252ef8c204c56c474764f7c55f7f7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 25b3186f4eddf85cc8a7a0b7e3c0d7b1622e6f5109aeb83ed6480f517a07ef9ad97938ef166e3a92b3b1d1c8935a047518141bf5780cc913010fcf0707c15e69
|
|
7
|
+
data.tar.gz: faaeb8f5bc57ae2a25493d171901f516c934713b7b0748ad07b093459db444bc4641884d45322cc34b874d45c791caa7b136a301b4608dd4f334a45f2d0d8127
|
data/README.md
CHANGED
|
@@ -40,9 +40,9 @@ By declaring parameter types, incoming parameters will automatically be transfor
|
|
|
40
40
|
- `String`
|
|
41
41
|
- `Integer`
|
|
42
42
|
- `Float`
|
|
43
|
-
- `
|
|
43
|
+
- `:boolean/TrueClass/FalseClass` _("1/0", "true/false", "t/f", "yes/no", "y/n")_
|
|
44
44
|
- `Array` _("1,2,3,4,5")_
|
|
45
|
-
- `Hash` _(key1:value1,key2:value2)_
|
|
45
|
+
- `Hash` _("key1:value1,key2:value2")_
|
|
46
46
|
- `Date`, `Time`, & `DateTime`
|
|
47
47
|
|
|
48
48
|
### Validations
|
data/lib/rails_param/param.rb
CHANGED
|
@@ -53,7 +53,7 @@ module RailsParam
|
|
|
53
53
|
return DateTime.parse(param) if type == DateTime
|
|
54
54
|
return Array(param.split(options[:delimiter] || ",")) if type == Array
|
|
55
55
|
return Hash[param.split(options[:delimiter] || ",").map{|c| c.split(options[:separator] || ":")}] if type == Hash
|
|
56
|
-
return (/(false|f|no|n|0)$/i === param.to_s ? false : (/(true|t|yes|y|1)$/i === param.to_s ? true : nil)) if type == TrueClass || type == FalseClass || type ==
|
|
56
|
+
return (/(false|f|no|n|0)$/i === param.to_s ? false : (/(true|t|yes|y|1)$/i === param.to_s ? true : nil)) if type == TrueClass || type == FalseClass || type == :boolean
|
|
57
57
|
return nil
|
|
58
58
|
rescue ArgumentError
|
|
59
59
|
raise InvalidParameterError, "'#{param}' is not a valid #{type}"
|
data/lib/rails_param/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rails_param
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Nicolas Blanco
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-08-
|
|
11
|
+
date: 2014-08-07 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rspec
|