hanami-validations 2.2.0.beta1 → 2.2.0.rc1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 55c78752af3331e752218f72726d6dae84d27dd51b25e8f6e91d81e2a9354396
4
- data.tar.gz: f45d2142477ae448b8d69114b26500e3b05f21041ca754cc972de554727a9325
3
+ metadata.gz: f8b8b53bd47c41e039b6cd47a269c5958bb4dc00fb76640f8da7c7c404638e8a
4
+ data.tar.gz: '094f9b7e59126bd37dd9df645d7a0706eec3d533ad02a042e343c8f07ae8896d'
5
5
  SHA512:
6
- metadata.gz: 9b29741bca88f9691e5e2ca9aacca765315436aa52996080a6c2234a4707810b7367c77ff45bf636ba7cd11380fb7996b2c8da7ca6300cc160c5b8a9681f975b
7
- data.tar.gz: 8fc8fc74919ff686d536a5f3b9d8fdf3900cd08786f90c4fe2e36dad0d69c2ce0e7c6893d9c9e379f1162fab7b46b068332094c5db7ac7cda366639475bcd8c0
6
+ metadata.gz: bd7162f9cd52dc57e97fa479f00a1c2d5a7f80d3403ec6794193e88b6628ca1007a4c32916fb5f04ee8742bb80e561d16f9533d01e35df6588b9ef6fbc06ff85
7
+ data.tar.gz: 34bf3cc79dc52c7d5a3da9f099e90783920033a81ff50be8423488679289d4cef7fdbd64573843e9cd0d74b8bfc9fdbf9587cd3f73d39611da309c02e1b07819
data/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  Validations mixin for Ruby objects
4
4
 
5
+ ## v2.2.0.rc1 - 2024-10-29
6
+
7
+ ## v2.2.0.beta2 - 2024-09-25
8
+
9
+ ### Changed
10
+
11
+ - [Tim Riley] Remove all Ruby code from the gem. This gem now exists only to manage the dependency on dry-validation. (#230)
12
+
5
13
  ## v2.2.0.beta1 - 2024-07-16
6
14
 
7
15
  ### Changed
@@ -21,7 +21,6 @@ Gem::Specification.new do |spec|
21
21
  spec.required_ruby_version = ">= 3.1"
22
22
 
23
23
  spec.add_dependency "dry-validation", ">= 1.10", "< 2"
24
- spec.add_dependency "zeitwerk", "~> 2.6.0"
25
24
 
26
25
  spec.add_development_dependency "bundler", ">= 1.6", "< 3"
27
26
  spec.add_development_dependency "rake", "~> 13"
@@ -6,6 +6,6 @@ module Hanami
6
6
  #
7
7
  # @since 0.1.0
8
8
  # @api public
9
- VERSION = "2.2.0.beta1"
9
+ VERSION = "2.2.0.rc1"
10
10
  end
11
11
  end
@@ -1,8 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "dry/validation"
4
- require "delegate"
5
- require "zeitwerk"
6
4
 
7
5
  # @see Hanami::Validations
8
6
  # @since 0.1.0
@@ -10,100 +8,6 @@ module Hanami
10
8
  # @since 0.1.0
11
9
  # @api private
12
10
  module Validations
13
- # @since 2.0.0
14
- # @api private
15
- def self.gem_loader
16
- @gem_loader ||= Zeitwerk::Loader.new.tap do |loader|
17
- root = File.expand_path("..", __dir__)
18
- loader.tag = "hanami-validations"
19
- loader.inflector = Zeitwerk::GemInflector.new("#{root}/hanami-validations.rb")
20
- loader.push_dir(root)
21
- loader.ignore(
22
- "#{root}/hanami-validations.rb",
23
- "#{root}/hanami/validations/version.rb"
24
- )
25
- end
26
- end
27
-
28
- gem_loader.setup
29
11
  require_relative "validations/version"
30
-
31
- # @since 0.1.0
32
- # @api private
33
- def self.included(klass)
34
- super
35
- klass.extend(ClassMethods)
36
- end
37
-
38
- # @since 2.0.0
39
- # @api private
40
- class Result < SimpleDelegator
41
- # @since 2.0.0
42
- # @api private
43
- def output
44
- __getobj__.to_h
45
- end
46
-
47
- # @since 2.0.0
48
- # @api private
49
- def messages
50
- __getobj__.errors.to_h
51
- end
52
- end
53
-
54
- # Validations DSL
55
- #
56
- # @since 0.1.0
57
- # @api private
58
- module ClassMethods
59
- # Define validation rules from the given block.
60
- #
61
- # @param blk [Proc] validation rules
62
- #
63
- # @since 0.6.0
64
- # @api private
65
- def validations(&blk)
66
- @_validator = Dry::Validation::Contract.build { schema(&blk) }
67
- end
68
-
69
- # @since 2.0.0
70
- # @api private
71
- def _validator
72
- @_validator
73
- end
74
- end
75
-
76
- # Initialize a new instance of a validator
77
- #
78
- # @param input [#to_h] a set of input data
79
- #
80
- # @since 0.6.0
81
- # @api private
82
- def initialize(input)
83
- @input = input
84
- end
85
-
86
- # Validates the object.
87
- #
88
- # @return [Hanami::Validations::Result]
89
- #
90
- # @since 0.2.4
91
- # @api private
92
- def validate
93
- Result.new(
94
- self.class._validator.call(@input)
95
- )
96
- end
97
-
98
- # Returns a Hash with the defined attributes as symbolized keys, and their
99
- # relative values.
100
- #
101
- # @return [Hash]
102
- #
103
- # @since 0.1.0
104
- # @api private
105
- def to_h
106
- validate.to_h
107
- end
108
12
  end
109
13
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hanami-validations
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0.beta1
4
+ version: 2.2.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luca Guidi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-16 00:00:00.000000000 Z
11
+ date: 2024-10-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-validation
@@ -30,20 +30,6 @@ dependencies:
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: '2'
33
- - !ruby/object:Gem::Dependency
34
- name: zeitwerk
35
- requirement: !ruby/object:Gem::Requirement
36
- requirements:
37
- - - "~>"
38
- - !ruby/object:Gem::Version
39
- version: 2.6.0
40
- type: :runtime
41
- prerelease: false
42
- version_requirements: !ruby/object:Gem::Requirement
43
- requirements:
44
- - - "~>"
45
- - !ruby/object:Gem::Version
46
- version: 2.6.0
47
33
  - !ruby/object:Gem::Dependency
48
34
  name: bundler
49
35
  requirement: !ruby/object:Gem::Requirement
@@ -119,9 +105,7 @@ files:
119
105
  - hanami-validations.gemspec
120
106
  - lib/hanami-validations.rb
121
107
  - lib/hanami/validations.rb
122
- - lib/hanami/validations/form.rb
123
108
  - lib/hanami/validations/version.rb
124
- - lib/hanami/validator.rb
125
109
  homepage: http://hanamirb.org
126
110
  licenses:
127
111
  - MIT
@@ -142,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
126
  - !ruby/object:Gem::Version
143
127
  version: '0'
144
128
  requirements: []
145
- rubygems_version: 3.5.9
129
+ rubygems_version: 3.5.22
146
130
  signing_key:
147
131
  specification_version: 4
148
132
  summary: Validations mixin for Ruby objects
@@ -1,40 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Hanami
4
- module Validations
5
- # Validations mixin for forms/HTTP params.
6
- #
7
- # @since 0.6.0
8
- # @api private
9
- module Form
10
- # @since 2.0.0
11
- # @api private
12
- class BaseValidator < Dry::Validation::Contract
13
- params do
14
- optional(:_csrf_token).filled(:string)
15
- end
16
- end
17
-
18
- # @since 0.6.0
19
- # @api private
20
- def self.included(klass)
21
- super
22
-
23
- klass.class_eval do
24
- include ::Hanami::Validations
25
- extend ClassMethods
26
- end
27
- end
28
-
29
- # @since 0.6.0
30
- # @api private
31
- module ClassMethods
32
- # @since 2.0.0
33
- # @api private
34
- def validations(&blk)
35
- @_validator = Class.new(BaseValidator) { params(&blk) }.new
36
- end
37
- end
38
- end
39
- end
40
- end
@@ -1,10 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "dry/validation"
4
-
5
- module Hanami
6
- # @since 2.0.0
7
- # @api private
8
- class Validator < Dry::Validation::Contract
9
- end
10
- end