stronger_parameters 2.10.1 → 2.11.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
  SHA256:
3
- metadata.gz: 8fd58b7c7abd50d4c49328bd4c1ed5f394a30d0e713605ef853772cbb3a48d65
4
- data.tar.gz: 755ada7e832133b1c797df0265e5e3b765af8106866c031f8de738a46f84f7d5
3
+ metadata.gz: d7bf5a04a553cb2a9a0db16f88d9d6b387d8f607150d998338afd18b50b0d3ac
4
+ data.tar.gz: fa3ec817f7042d045d66761db3280b49b9b05fe33e094f1930ca0a80699d3286
5
5
  SHA512:
6
- metadata.gz: 196c792377887933facef2fb25632bb5d6641e848786a821b4f4cfb254a5b04dfe2f12f9ebbb66928ada0a1ed69a6001f725708c7b9f2e2d613e14d5f83db489
7
- data.tar.gz: d0bb7384ec7ad0a419564c42f4610867dae7948ac630261b63fd73ac32c1d22661bffe2577be5f1fa82669fe9c8b5fd401b2f23a6848272d17003b2b42c120fa
6
+ metadata.gz: 1368dd9057bdaac8cd2f89dc174c513f84bb56ddc49fc421f1c840861cffe7a1cc0e8eec4bc939f06cc681bedbc553c6cd3d8132a19d4b2343f21b648d96fc58
7
+ data.tar.gz: 0ced957cd68f9843d098d4bf4350a8466766aba1fb30a3101ff114591087f490ac8b429a01a6767fea677a80f6d0e2367f9ea3f62c3c73d633a7e2874646b63e
@@ -3,6 +3,7 @@ require 'stronger_parameters/constraint'
3
3
  require 'stronger_parameters/constraints/string_constraint'
4
4
  require 'stronger_parameters/constraints/float_constraint'
5
5
  require 'stronger_parameters/constraints/date_time_constraint'
6
+ require 'stronger_parameters/constraints/date_time_iso8601_constraint'
6
7
  require 'stronger_parameters/constraints/regexp_constraint'
7
8
  require 'stronger_parameters/constraints/integer_constraint'
8
9
  require 'stronger_parameters/constraints/nil_constraint'
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+ # rubocop:disable Style/DateTime
3
+ require 'stronger_parameters/constraint'
4
+
5
+ module StrongerParameters
6
+ class DateTimeIso8601Constraint < Constraint
7
+ def value(v)
8
+ DateTime.iso8601 v
9
+ rescue ArgumentError, TypeError
10
+ StrongerParameters::InvalidValue.new(v, "must be an iso8601 date")
11
+ end
12
+ end
13
+ end
14
+ # rubocop:enable Style/DateTime
@@ -112,6 +112,10 @@ module StrongerParameters
112
112
  DateTimeConstraint.new
113
113
  end
114
114
 
115
+ def datetime_iso8601
116
+ DateTimeIso8601Constraint.new
117
+ end
118
+
115
119
  def file
116
120
  FileConstraint.new
117
121
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module StrongerParameters
3
- VERSION = '2.10.1'
3
+ VERSION = '2.11.0'
4
4
  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.10.1
4
+ version: 2.11.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: 2018-04-10 00:00:00.000000000 Z
11
+ date: 2018-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -199,6 +199,7 @@ files:
199
199
  - lib/stronger_parameters/constraints/boolean_constraint.rb
200
200
  - lib/stronger_parameters/constraints/comparison_constraints.rb
201
201
  - lib/stronger_parameters/constraints/date_time_constraint.rb
202
+ - lib/stronger_parameters/constraints/date_time_iso8601_constraint.rb
202
203
  - lib/stronger_parameters/constraints/decimal_constraint.rb
203
204
  - lib/stronger_parameters/constraints/enumeration_constraint.rb
204
205
  - lib/stronger_parameters/constraints/file_constraint.rb