expectant 0.3.0 → 0.3.2

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.
@@ -1,46 +1,46 @@
1
- # frozen_string_literal: true
2
-
3
- require "active_support/inflector"
4
-
5
- module Expectant
6
- module Utils
7
- module_function
8
-
9
- def singularize(word)
10
- ActiveSupport::Inflector.singularize(word.to_s).to_sym
11
- end
12
-
13
- def validator_method_name(schema_name, configuration)
14
- prefix = configuration.validator_prefix
15
- suffix = configuration.validator_suffix
16
-
17
- parts = []
18
- parts << prefix if prefix
19
- parts << schema_name
20
- parts << suffix if suffix
21
-
22
- parts.join("_")
23
- end
24
-
25
- def define_with_collision_policy(target, method_name, collision:, &block)
26
- method_name = method_name.to_sym
27
- if target.method_defined?(method_name) || target.private_method_defined?(method_name)
28
- case collision
29
- when :error
30
- raise ConfigurationError, "Method #{method_name} already defined"
31
- when :force
32
- begin
33
- target.send(:remove_method, method_name)
34
- rescue
35
- nil
36
- end
37
- block.call
38
- else
39
- raise ConfigurationError, "Unknown collision policy: #{collision}"
40
- end
41
- else
42
- block.call
43
- end
44
- end
45
- end
46
- end
1
+ # frozen_string_literal: true
2
+
3
+ require "active_support/inflector"
4
+
5
+ module Expectant
6
+ module Utils
7
+ module_function
8
+
9
+ def singularize(word)
10
+ ActiveSupport::Inflector.singularize(word.to_s).to_sym
11
+ end
12
+
13
+ def validator_method_name(schema_name, configuration)
14
+ prefix = configuration.validator_prefix
15
+ suffix = configuration.validator_suffix
16
+
17
+ parts = []
18
+ parts << prefix if prefix
19
+ parts << schema_name
20
+ parts << suffix if suffix
21
+
22
+ parts.join("_")
23
+ end
24
+
25
+ def define_with_collision_policy(target, method_name, collision:, &block)
26
+ method_name = method_name.to_sym
27
+ if target.method_defined?(method_name) || target.private_method_defined?(method_name)
28
+ case collision
29
+ when :error
30
+ raise ConfigurationError, "Method #{method_name} already defined"
31
+ when :force
32
+ begin
33
+ target.send(:remove_method, method_name)
34
+ rescue
35
+ nil
36
+ end
37
+ block.call
38
+ else
39
+ raise ConfigurationError, "Unknown collision policy: #{collision}"
40
+ end
41
+ else
42
+ block.call
43
+ end
44
+ end
45
+ end
46
+ end
@@ -1,5 +1,5 @@
1
- # frozen_string_literal: true
2
-
3
- module Expectant
4
- VERSION = "0.3.0"
5
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Expectant
4
+ VERSION = "0.3.2"
5
+ end
data/lib/expectant.rb CHANGED
@@ -1,26 +1,26 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "expectant/version"
4
- require_relative "expectant/errors"
5
- require_relative "expectant/configuration"
6
- require_relative "expectant/types"
7
- require_relative "expectant/dsl"
8
- require_relative "expectant/expectation"
9
-
10
- module Expectant
11
- class << self
12
- attr_writer :configuration
13
-
14
- def configuration
15
- @configuration ||= Configuration.new
16
- end
17
-
18
- def configure
19
- yield(configuration)
20
- end
21
-
22
- def reset_configuration!
23
- @configuration = Configuration.new
24
- end
25
- end
26
- end
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "expectant/version"
4
+ require_relative "expectant/errors"
5
+ require_relative "expectant/configuration"
6
+ require_relative "expectant/types"
7
+ require_relative "expectant/dsl"
8
+ require_relative "expectant/expectation"
9
+
10
+ module Expectant
11
+ class << self
12
+ attr_writer :configuration
13
+
14
+ def configuration
15
+ @configuration ||= Configuration.new
16
+ end
17
+
18
+ def configure
19
+ yield(configuration)
20
+ end
21
+
22
+ def reset_configuration!
23
+ @configuration = Configuration.new
24
+ end
25
+ end
26
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: expectant
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hector Medina Fetterman
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-10-09 00:00:00.000000000 Z
11
+ date: 2026-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-validation
@@ -62,6 +62,7 @@ executables: []
62
62
  extensions: []
63
63
  extra_rdoc_files: []
64
64
  files:
65
+ - ".editorconfig"
65
66
  - ".rspec"
66
67
  - ".standard.yml"
67
68
  - CHANGELOG.md
@@ -100,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
101
  - !ruby/object:Gem::Version
101
102
  version: '0'
102
103
  requirements: []
103
- rubygems_version: 3.4.10
104
+ rubygems_version: 3.4.19
104
105
  signing_key:
105
106
  specification_version: 4
106
107
  summary: A flexible DSL for defining reusable validation schemas