stronger_parameters 2.5.0 → 2.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e87d6cc0e6f6878f529537e78e3958cdd708bd6e
4
- data.tar.gz: 5c898efbcaf23d4f263e2f96cb2bc9694acc849e
3
+ metadata.gz: 9cee9c15067d436594362c541eda36feab8727e6
4
+ data.tar.gz: ff64518e518b16e4077a9539a056c4906bfbaf43
5
5
  SHA512:
6
- metadata.gz: 4e8a57b30635864df2e97eaddffa9562573aa1c3e8d81620dcbeb439a19f4ebaf84905908ef8ed12803e36ca14b3c6d5737a11c14ce41486c6ddf1b6df29bd2b
7
- data.tar.gz: a668ec3302be6dff0d420cc4e830c23b4e0a447a05068b63365828b8f28cb7583b5453bab0e8a0031f39203a36c278bf43900e676a90d868306f558a76185423
6
+ metadata.gz: 28f33d4429925ec7e889dfa42ccb7c8efc0c06d3a8d7da778c584f17483de9b3585e28c2d8ad3725a975fe7171e9ed457fb53c539a59f84520e337a6d93f25c2
7
+ data.tar.gz: ce86345534a475a3030ceefffa52d0de28619373c7bc57f07c63666199c9814118a8e87470e62cdb2fc91c104d2849ef8f9ad73a4b2cfb41330d1d1d6ef769ad
data/README.md CHANGED
@@ -182,4 +182,5 @@ ActionController::Parameters.action_on_invalid_parameters = :log
182
182
  | Parameters.nil | value is nil |
183
183
  | Parameters.nil_string | value is nil, '', 'undefined' |
184
184
  | Parameters.file | File, StringIO, Rack::Test::UploadedFile, ActionDispatch::Http::UploadedFile or subclasses |
185
- | Parameters.decimal(8,2) | value is a String, Integer or Float with a precision of 8 and scale of 2 |
185
+ | Parameters.decimal(8,2) | value is a String, Integer or Float with a precision of 9 and scale of 2 |
186
+ | Parameters.hex | value is a String that matches the hexadecimal format |
@@ -91,3 +91,4 @@ require 'stronger_parameters/constraints/comparison_constraints'
91
91
  require 'stronger_parameters/constraints/nil_string_constraint'
92
92
  require 'stronger_parameters/constraints/file_constraint'
93
93
  require 'stronger_parameters/constraints/decimal_constraint'
94
+ require 'stronger_parameters/constraints/hex_constraint'
@@ -0,0 +1,11 @@
1
+ require 'stronger_parameters/constraints'
2
+
3
+ module StrongerParameters
4
+ class HexConstraint < Constraint
5
+ def value(v)
6
+ return v if v =~ /\A[a-f0-9]+\z/i
7
+
8
+ InvalidValue.new(v, 'must be a hexadecimal string')
9
+ end
10
+ end
11
+ end
@@ -118,6 +118,10 @@ module StrongerParameters
118
118
  def decimal(precision = 8, scale =2)
119
119
  DecimalConstraint.new(precision, scale)
120
120
  end
121
+
122
+ def hex
123
+ HexConstraint.new
124
+ end
121
125
  end
122
126
 
123
127
  def hash_filter_with_stronger_parameters(params, filter)
@@ -1,3 +1,3 @@
1
1
  module StrongerParameters
2
- VERSION = '2.5.0'
2
+ VERSION = '2.6.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stronger_parameters
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.0
4
+ version: 2.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mick Staugaard
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-02 00:00:00.000000000 Z
11
+ date: 2016-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -189,6 +189,7 @@ files:
189
189
  - lib/stronger_parameters/constraints/file_constraint.rb
190
190
  - lib/stronger_parameters/constraints/float_constraint.rb
191
191
  - lib/stronger_parameters/constraints/hash_constraint.rb
192
+ - lib/stronger_parameters/constraints/hex_constraint.rb
192
193
  - lib/stronger_parameters/constraints/integer_constraint.rb
193
194
  - lib/stronger_parameters/constraints/nil_constraint.rb
194
195
  - lib/stronger_parameters/constraints/nil_string_constraint.rb