hanami-validations 1.3.8 → 2.0.0.alpha1

Sign up to get free protection for your applications and to get access to all the features.
metadata CHANGED
@@ -1,83 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hanami-validations
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.8
4
+ version: 2.0.0.alpha1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luca Guidi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-14 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'
26
+ version: '1.0'
81
27
  - !ruby/object:Gem::Dependency
82
28
  name: bundler
83
29
  requirement: !ruby/object:Gem::Requirement
@@ -104,42 +50,28 @@ dependencies:
104
50
  requirements:
105
51
  - - "~>"
106
52
  - !ruby/object:Gem::Version
107
- version: '13'
53
+ version: '12'
108
54
  type: :development
109
55
  prerelease: false
110
56
  version_requirements: !ruby/object:Gem::Requirement
111
57
  requirements:
112
58
  - - "~>"
113
59
  - !ruby/object:Gem::Version
114
- version: '13'
60
+ version: '12'
115
61
  - !ruby/object:Gem::Dependency
116
62
  name: rspec
117
63
  requirement: !ruby/object:Gem::Requirement
118
64
  requirements:
119
65
  - - "~>"
120
66
  - !ruby/object:Gem::Version
121
- version: '3.9'
67
+ version: '3.7'
122
68
  type: :development
123
69
  prerelease: false
124
70
  version_requirements: !ruby/object:Gem::Requirement
125
71
  requirements:
126
72
  - - "~>"
127
73
  - !ruby/object:Gem::Version
128
- version: '3.9'
129
- - !ruby/object:Gem::Dependency
130
- name: rubocop
131
- requirement: !ruby/object:Gem::Requirement
132
- requirements:
133
- - - '='
134
- - !ruby/object:Gem::Version
135
- version: '0.81'
136
- type: :development
137
- prerelease: false
138
- version_requirements: !ruby/object:Gem::Requirement
139
- requirements:
140
- - - '='
141
- - !ruby/object:Gem::Version
142
- version: '0.81'
74
+ version: '3.7'
143
75
  description: Validations mixin for Ruby objects and support for Hanami
144
76
  email:
145
77
  - me@lucaguidi.com
@@ -151,13 +83,10 @@ files:
151
83
  - LICENSE.md
152
84
  - README.md
153
85
  - hanami-validations.gemspec
154
- - lib/hanami-validations.rb
155
86
  - lib/hanami/validations.rb
156
87
  - lib/hanami/validations/form.rb
157
- - lib/hanami/validations/inline_predicate.rb
158
- - lib/hanami/validations/namespace.rb
159
- - lib/hanami/validations/predicates.rb
160
88
  - lib/hanami/validations/version.rb
89
+ - lib/hanami/validator.rb
161
90
  homepage: http://hanamirb.org
162
91
  licenses:
163
92
  - MIT
@@ -170,14 +99,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
170
99
  requirements:
171
100
  - - ">="
172
101
  - !ruby/object:Gem::Version
173
- version: 2.3.0
102
+ version: 2.4.0
174
103
  required_rubygems_version: !ruby/object:Gem::Requirement
175
104
  requirements:
176
- - - ">="
105
+ - - ">"
177
106
  - !ruby/object:Gem::Version
178
- version: '0'
107
+ version: 1.3.1
179
108
  requirements: []
180
- rubygems_version: 3.2.2
109
+ rubygems_version: 3.0.3
181
110
  signing_key:
182
111
  specification_version: 4
183
112
  summary: Validations mixin for Ruby objects
@@ -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"