hanami-validations 1.3.9 → 2.0.0.alpha1

Sign up to get free protection for your applications and to get access to all the features.
metadata CHANGED
@@ -1,97 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hanami-validations
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.9
4
+ version: 2.0.0.alpha1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luca Guidi
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-08-25 00:00:00.000000000 Z
11
+ date: 2019-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: hanami-utils
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '1.3'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '1.3'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: dry-validation
29
15
  requirement: !ruby/object:Gem::Requirement
30
16
  requirements:
31
17
  - - "~>"
32
18
  - !ruby/object:Gem::Version
33
- version: '0.11'
34
- - - "<"
35
- - !ruby/object:Gem::Version
36
- version: '0.12'
19
+ version: '1.0'
37
20
  type: :runtime
38
21
  prerelease: false
39
22
  version_requirements: !ruby/object:Gem::Requirement
40
23
  requirements:
41
24
  - - "~>"
42
25
  - !ruby/object:Gem::Version
43
- version: '0.11'
44
- - - "<"
45
- - !ruby/object:Gem::Version
46
- version: '0.12'
47
- - !ruby/object:Gem::Dependency
48
- name: dry-logic
49
- requirement: !ruby/object:Gem::Requirement
50
- requirements:
51
- - - "~>"
52
- - !ruby/object:Gem::Version
53
- version: 0.4.2
54
- - - "<"
55
- - !ruby/object:Gem::Version
56
- version: '0.5'
57
- type: :runtime
58
- prerelease: false
59
- version_requirements: !ruby/object:Gem::Requirement
60
- requirements:
61
- - - "~>"
62
- - !ruby/object:Gem::Version
63
- version: 0.4.2
64
- - - "<"
65
- - !ruby/object:Gem::Version
66
- version: '0.5'
67
- - !ruby/object:Gem::Dependency
68
- name: dry-configurable
69
- requirement: !ruby/object:Gem::Requirement
70
- requirements:
71
- - - "<="
72
- - !ruby/object:Gem::Version
73
- version: '0.12'
74
- type: :runtime
75
- prerelease: false
76
- version_requirements: !ruby/object:Gem::Requirement
77
- requirements:
78
- - - "<="
79
- - !ruby/object:Gem::Version
80
- version: '0.12'
81
- - !ruby/object:Gem::Dependency
82
- name: dry-container
83
- requirement: !ruby/object:Gem::Requirement
84
- requirements:
85
- - - "<="
86
- - !ruby/object:Gem::Version
87
- version: '0.9'
88
- type: :runtime
89
- prerelease: false
90
- version_requirements: !ruby/object:Gem::Requirement
91
- requirements:
92
- - - "<="
93
- - !ruby/object:Gem::Version
94
- version: '0.9'
26
+ version: '1.0'
95
27
  - !ruby/object:Gem::Dependency
96
28
  name: bundler
97
29
  requirement: !ruby/object:Gem::Requirement
@@ -118,42 +50,28 @@ dependencies:
118
50
  requirements:
119
51
  - - "~>"
120
52
  - !ruby/object:Gem::Version
121
- version: '13'
53
+ version: '12'
122
54
  type: :development
123
55
  prerelease: false
124
56
  version_requirements: !ruby/object:Gem::Requirement
125
57
  requirements:
126
58
  - - "~>"
127
59
  - !ruby/object:Gem::Version
128
- version: '13'
60
+ version: '12'
129
61
  - !ruby/object:Gem::Dependency
130
62
  name: rspec
131
63
  requirement: !ruby/object:Gem::Requirement
132
64
  requirements:
133
65
  - - "~>"
134
66
  - !ruby/object:Gem::Version
135
- version: '3.9'
67
+ version: '3.7'
136
68
  type: :development
137
69
  prerelease: false
138
70
  version_requirements: !ruby/object:Gem::Requirement
139
71
  requirements:
140
72
  - - "~>"
141
73
  - !ruby/object:Gem::Version
142
- version: '3.9'
143
- - !ruby/object:Gem::Dependency
144
- name: rubocop
145
- requirement: !ruby/object:Gem::Requirement
146
- requirements:
147
- - - '='
148
- - !ruby/object:Gem::Version
149
- version: '0.81'
150
- type: :development
151
- prerelease: false
152
- version_requirements: !ruby/object:Gem::Requirement
153
- requirements:
154
- - - '='
155
- - !ruby/object:Gem::Version
156
- version: '0.81'
74
+ version: '3.7'
157
75
  description: Validations mixin for Ruby objects and support for Hanami
158
76
  email:
159
77
  - me@lucaguidi.com
@@ -165,18 +83,15 @@ files:
165
83
  - LICENSE.md
166
84
  - README.md
167
85
  - hanami-validations.gemspec
168
- - lib/hanami-validations.rb
169
86
  - lib/hanami/validations.rb
170
87
  - lib/hanami/validations/form.rb
171
- - lib/hanami/validations/inline_predicate.rb
172
- - lib/hanami/validations/namespace.rb
173
- - lib/hanami/validations/predicates.rb
174
88
  - lib/hanami/validations/version.rb
89
+ - lib/hanami/validator.rb
175
90
  homepage: http://hanamirb.org
176
91
  licenses:
177
92
  - MIT
178
93
  metadata: {}
179
- post_install_message:
94
+ post_install_message:
180
95
  rdoc_options: []
181
96
  require_paths:
182
97
  - lib
@@ -184,15 +99,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
184
99
  requirements:
185
100
  - - ">="
186
101
  - !ruby/object:Gem::Version
187
- version: 2.3.0
102
+ version: 2.4.0
188
103
  required_rubygems_version: !ruby/object:Gem::Requirement
189
104
  requirements:
190
- - - ">="
105
+ - - ">"
191
106
  - !ruby/object:Gem::Version
192
- version: '0'
107
+ version: 1.3.1
193
108
  requirements: []
194
- rubygems_version: 3.3.7
195
- signing_key:
109
+ rubygems_version: 3.0.3
110
+ signing_key:
196
111
  specification_version: 4
197
112
  summary: Validations mixin for Ruby objects
198
113
  test_files: []
@@ -1,48 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Hanami
4
- module Validations
5
- # Inline predicate
6
- #
7
- # @since 0.6.0
8
- # @api private
9
- class InlinePredicate
10
- # @since 0.6.0
11
- # @api private
12
- attr_reader :name
13
-
14
- # @since 0.6.0
15
- # @api private
16
- attr_reader :message
17
-
18
- # Return a new instance.
19
- #
20
- # @param name [Symbol] inline predicate name
21
- # @param message [String] optional failure message
22
- # @param blk [Proc] predicate implementation
23
- #
24
- # @return [Hanami::Validations::InlinePredicate] a new instance
25
- #
26
- # @since 0.6.0
27
- # @api private
28
- def initialize(name, message, &blk)
29
- @name = name
30
- @message = message
31
- @blk = blk
32
- end
33
-
34
- # @since 0.6.0
35
- # @api private
36
- def to_proc
37
- @blk
38
- end
39
-
40
- # @since 0.6.0
41
- # @api private
42
- def ==(other)
43
- self.class == other.class &&
44
- name == other.name
45
- end
46
- end
47
- end
48
- end
@@ -1,67 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "hanami/utils/string"
4
-
5
- module Hanami
6
- module Validations
7
- # Validations message namespace.
8
- #
9
- # For a given `FooValidator` class, it will look for I18n messages within
10
- # the `foo` group.
11
- #
12
- # @since 0.6.0
13
- # @api private
14
- class Namespace
15
- # @since 0.6.0
16
- # @api private
17
- SUFFIX = "Validator"
18
-
19
- # @since 0.6.0
20
- # @api private
21
- SUFFIX_REPLACEMENT = ""
22
-
23
- # @since 0.6.0
24
- # @api private
25
- RUBY_NAMESPACE_SEPARATOR = "/"
26
-
27
- # @since 0.6.0
28
- # @api private
29
- RUBY_NAMESPACE_REPLACEMENT = "."
30
-
31
- # @since 0.6.0
32
- # @api private
33
- def self.new(name, klass)
34
- result = name || klass.name
35
- return nil if result.nil?
36
-
37
- super(result)
38
- end
39
-
40
- # @since 0.6.0
41
- # @api private
42
- def initialize(name)
43
- @name = name
44
- end
45
-
46
- # @since 0.6.0
47
- # @api private
48
- def to_s
49
- underscored_name.gsub(RUBY_NAMESPACE_SEPARATOR, RUBY_NAMESPACE_REPLACEMENT)
50
- end
51
-
52
- private
53
-
54
- # @since 0.6.0
55
- # @api private
56
- def underscored_name
57
- Utils::String.underscore(name_without_suffix)
58
- end
59
-
60
- # @since 0.6.0
61
- # @api private
62
- def name_without_suffix
63
- @name.sub(SUFFIX, SUFFIX_REPLACEMENT)
64
- end
65
- end
66
- end
67
- end
@@ -1,47 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "dry/logic/predicates"
4
- require "hanami/utils/class_attribute"
5
-
6
- module Hanami
7
- module Validations
8
- # Mixin to include when defining shared predicates
9
- #
10
- # @since 0.6.0
11
- #
12
- # @see Hanami::Validations::ClassMethods#predicates
13
- #
14
- # @example Inline Predicate
15
- # require 'hanami/validations'
16
- #
17
- # module MySharedPredicates
18
- # include Hanami::Validations::Predicates
19
- #
20
- # predicate :foo? do |actual|
21
- # actual == 'foo'
22
- # end
23
- # end
24
- #
25
- # class MyValidator
26
- # include Hanami::Validations
27
- # predicates MySharedPredicates
28
- #
29
- # validations do
30
- # required(:name).filled(:foo?)
31
- # end
32
- # end
33
- module Predicates
34
- # @since 0.6.0
35
- # @api private
36
- def self.included(base)
37
- base.class_eval do
38
- include Dry::Logic::Predicates
39
- include Utils::ClassAttribute
40
-
41
- class_attribute :messages
42
- class_attribute :messages_path
43
- end
44
- end
45
- end
46
- end
47
- end
@@ -1,3 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "hanami/validations"