hash_validator 2.0.0 → 2.0.1

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.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +6 -1
  3. data/.rubocop.yml +340 -0
  4. data/Gemfile +3 -1
  5. data/README.md +2 -1
  6. data/Rakefile +6 -4
  7. data/hash_validator.gemspec +11 -5
  8. data/lib/hash_validator/base.rb +2 -0
  9. data/lib/hash_validator/configuration.rb +5 -3
  10. data/lib/hash_validator/validations/many.rb +2 -0
  11. data/lib/hash_validator/validations/multiple.rb +2 -0
  12. data/lib/hash_validator/validations/optional.rb +2 -0
  13. data/lib/hash_validator/validations.rb +5 -3
  14. data/lib/hash_validator/validators/alpha_validator.rb +5 -3
  15. data/lib/hash_validator/validators/alphanumeric_validator.rb +5 -3
  16. data/lib/hash_validator/validators/array_validator.rb +44 -48
  17. data/lib/hash_validator/validators/base.rb +6 -4
  18. data/lib/hash_validator/validators/boolean_validator.rb +3 -1
  19. data/lib/hash_validator/validators/class_validator.rb +3 -1
  20. data/lib/hash_validator/validators/digits_validator.rb +5 -3
  21. data/lib/hash_validator/validators/dynamic_func_validator.rb +8 -8
  22. data/lib/hash_validator/validators/dynamic_pattern_validator.rb +5 -3
  23. data/lib/hash_validator/validators/email_validator.rb +4 -2
  24. data/lib/hash_validator/validators/enumerable_validator.rb +4 -2
  25. data/lib/hash_validator/validators/hash_validator.rb +5 -3
  26. data/lib/hash_validator/validators/hex_color_validator.rb +5 -3
  27. data/lib/hash_validator/validators/ip_validator.rb +6 -4
  28. data/lib/hash_validator/validators/ipv4_validator.rb +5 -3
  29. data/lib/hash_validator/validators/ipv6_validator.rb +6 -4
  30. data/lib/hash_validator/validators/json_validator.rb +6 -4
  31. data/lib/hash_validator/validators/lambda_validator.rb +4 -2
  32. data/lib/hash_validator/validators/many_validator.rb +3 -1
  33. data/lib/hash_validator/validators/multiple_validator.rb +4 -2
  34. data/lib/hash_validator/validators/optional_validator.rb +3 -1
  35. data/lib/hash_validator/validators/presence_validator.rb +4 -2
  36. data/lib/hash_validator/validators/regex_validator.rb +4 -2
  37. data/lib/hash_validator/validators/simple_type_validators.rb +3 -1
  38. data/lib/hash_validator/validators/simple_validator.rb +2 -0
  39. data/lib/hash_validator/validators/url_validator.rb +6 -4
  40. data/lib/hash_validator/validators.rb +35 -33
  41. data/lib/hash_validator/version.rb +3 -1
  42. data/lib/hash_validator.rb +7 -5
  43. data/spec/configuration_spec.rb +76 -74
  44. data/spec/hash_validator_spec.rb +132 -113
  45. data/spec/hash_validator_spec_helper.rb +2 -0
  46. data/spec/spec_helper.rb +14 -4
  47. data/spec/validators/alpha_validator_spec.rb +43 -41
  48. data/spec/validators/alphanumeric_validator_spec.rb +44 -42
  49. data/spec/validators/array_spec.rb +102 -47
  50. data/spec/validators/base_spec.rb +25 -10
  51. data/spec/validators/boolean_spec.rb +15 -13
  52. data/spec/validators/class_spec.rb +20 -18
  53. data/spec/validators/digits_validator_spec.rb +46 -44
  54. data/spec/validators/dynamic_func_validator_spec.rb +90 -88
  55. data/spec/validators/dynamic_pattern_validator_spec.rb +65 -63
  56. data/spec/validators/email_spec.rb +15 -13
  57. data/spec/validators/hash_validator_spec.rb +39 -37
  58. data/spec/validators/hex_color_validator_spec.rb +49 -47
  59. data/spec/validators/in_enumerable_spec.rb +32 -30
  60. data/spec/validators/ip_validator_spec.rb +46 -44
  61. data/spec/validators/ipv4_validator_spec.rb +45 -43
  62. data/spec/validators/ipv6_validator_spec.rb +44 -42
  63. data/spec/validators/json_validator_spec.rb +38 -36
  64. data/spec/validators/lambda_spec.rb +20 -18
  65. data/spec/validators/many_spec.rb +25 -23
  66. data/spec/validators/multiple_spec.rb +13 -11
  67. data/spec/validators/optional_spec.rb +22 -20
  68. data/spec/validators/presence_spec.rb +16 -14
  69. data/spec/validators/regexp_spec.rb +14 -12
  70. data/spec/validators/simple_spec.rb +17 -15
  71. data/spec/validators/simple_types_spec.rb +21 -19
  72. data/spec/validators/url_validator_spec.rb +34 -32
  73. data/spec/validators/user_defined_spec.rb +29 -27
  74. metadata +59 -2
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class HashValidator::Validator::Base
2
4
  attr_accessor :name
3
5
 
@@ -6,7 +8,7 @@ class HashValidator::Validator::Base
6
8
  self.name = name.to_s
7
9
 
8
10
  unless self.name.size > 0
9
- raise StandardError.new('Validator must be initialized with a valid name (length greater than zero)')
11
+ raise StandardError.new("Validator must be initialized with a valid name (length greater than zero)")
10
12
  end
11
13
  end
12
14
 
@@ -30,16 +32,16 @@ class HashValidator::Validator::Base
30
32
  else
31
33
  raise StandardError.new("valid? method must accept either 1 argument (value) or 2 arguments (value, validations)")
32
34
  end
33
-
35
+
34
36
  unless valid_result
35
37
  errors[key] = error_message
36
38
  end
37
39
  else
38
40
  # Otherwise, subclass must override validate
39
- raise StandardError.new('Validator must implement either valid? or override validate method')
41
+ raise StandardError.new("Validator must implement either valid? or override validate method")
40
42
  end
41
43
  end
42
-
44
+
43
45
  # Subclasses can optionally implement this for simple boolean validation
44
46
  # Return true if valid, false if invalid
45
47
  # Either:
@@ -1,6 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class HashValidator::Validator::BooleanValidator < HashValidator::Validator::Base
2
4
  def initialize
3
- super('boolean') # The name of the validator
5
+ super("boolean") # The name of the validator
4
6
  end
5
7
 
6
8
  def valid?(value)
@@ -1,6 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class HashValidator::Validator::ClassValidator < HashValidator::Validator::Base
2
4
  def initialize
3
- super('_class') # The name of the validator, underscored as it won't usually be directly invoked (invoked through use of validator)
5
+ super("_class") # The name of the validator, underscored as it won't usually be directly invoked (invoked through use of validator)
4
6
  end
5
7
 
6
8
  def should_validate?(rhs)
@@ -1,10 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class HashValidator::Validator::DigitsValidator < HashValidator::Validator::Base
2
4
  def initialize
3
- super('digits') # The name of the validator
5
+ super("digits") # The name of the validator
4
6
  end
5
7
 
6
8
  def error_message
7
- 'must contain only digits'
9
+ "must contain only digits"
8
10
  end
9
11
 
10
12
  def valid?(value)
@@ -12,4 +14,4 @@ class HashValidator::Validator::DigitsValidator < HashValidator::Validator::Base
12
14
  end
13
15
  end
14
16
 
15
- HashValidator.add_validator(HashValidator::Validator::DigitsValidator.new)
17
+ HashValidator.add_validator(HashValidator::Validator::DigitsValidator.new)
@@ -1,13 +1,15 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class HashValidator::Validator::DynamicFuncValidator < HashValidator::Validator::Base
2
4
  attr_accessor :func, :custom_error_message
3
5
 
4
6
  def initialize(name, func, error_message = nil)
5
7
  super(name)
6
-
8
+
7
9
  unless func.respond_to?(:call)
8
10
  raise ArgumentError, "Function must be callable (proc or lambda)"
9
11
  end
10
-
12
+
11
13
  @func = func
12
14
  @custom_error_message = error_message
13
15
  end
@@ -17,10 +19,8 @@ class HashValidator::Validator::DynamicFuncValidator < HashValidator::Validator:
17
19
  end
18
20
 
19
21
  def valid?(value)
20
- begin
21
- !!@func.call(value)
22
- rescue => e
23
- false
24
- end
22
+ !!@func.call(value)
23
+ rescue
24
+ false
25
25
  end
26
- end
26
+ end
@@ -1,13 +1,15 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class HashValidator::Validator::DynamicPatternValidator < HashValidator::Validator::Base
2
4
  attr_accessor :pattern, :custom_error_message
3
5
 
4
6
  def initialize(name, pattern, error_message = nil)
5
7
  super(name)
6
-
8
+
7
9
  unless pattern.is_a?(Regexp)
8
10
  raise ArgumentError, "Pattern must be a regular expression"
9
11
  end
10
-
12
+
11
13
  @pattern = pattern
12
14
  @custom_error_message = error_message
13
15
  end
@@ -20,4 +22,4 @@ class HashValidator::Validator::DynamicPatternValidator < HashValidator::Validat
20
22
  return false unless value.respond_to?(:to_s)
21
23
  @pattern.match?(value.to_s)
22
24
  end
23
- end
25
+ end
@@ -1,10 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class HashValidator::Validator::EmailValidator < HashValidator::Validator::Base
2
4
  def initialize
3
- super('email') # The name of the validator
5
+ super("email") # The name of the validator
4
6
  end
5
7
 
6
8
  def error_message
7
- 'is not a valid email'
9
+ "is not a valid email"
8
10
  end
9
11
 
10
12
  def valid?(value)
@@ -1,6 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class HashValidator::Validator::EnumerableValidator < HashValidator::Validator::Base
2
4
  def initialize
3
- super('_enumerable') # The name of the validator, underscored as it won't usually be directly invoked (invoked through use of validator)
5
+ super("_enumerable") # The name of the validator, underscored as it won't usually be directly invoked (invoked through use of validator)
4
6
  end
5
7
 
6
8
  def should_validate?(rhs)
@@ -8,7 +10,7 @@ class HashValidator::Validator::EnumerableValidator < HashValidator::Validator::
8
10
  end
9
11
 
10
12
  def error_message
11
- 'value from list required'
13
+ "value from list required"
12
14
  end
13
15
 
14
16
  def valid?(value, validations)
@@ -1,6 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class HashValidator::Validator::HashValidator < HashValidator::Validator::Base
2
4
  def initialize
3
- super('hash')
5
+ super("hash")
4
6
  end
5
7
 
6
8
  def should_validate?(rhs)
@@ -28,12 +30,12 @@ class HashValidator::Validator::HashValidator < HashValidator::Validator::Base
28
30
 
29
31
  if HashValidator::Base.strict?
30
32
  value.keys.each do |k|
31
- errors[k] = 'key not expected' unless validations[k]
33
+ errors[k] = "key not expected" unless validations[k]
32
34
  end
33
35
  end
34
36
 
35
37
  # Cleanup errors (remove any empty nested errors)
36
- errors.delete_if { |_,v| v.empty? }
38
+ errors.delete_if { |_, v| v.empty? }
37
39
  end
38
40
  end
39
41
 
@@ -1,10 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class HashValidator::Validator::HexColorValidator < HashValidator::Validator::Base
2
4
  def initialize
3
- super('hex_color') # The name of the validator
5
+ super("hex_color") # The name of the validator
4
6
  end
5
7
 
6
8
  def error_message
7
- 'is not a valid hex color'
9
+ "is not a valid hex color"
8
10
  end
9
11
 
10
12
  def valid?(value)
@@ -12,4 +14,4 @@ class HashValidator::Validator::HexColorValidator < HashValidator::Validator::Ba
12
14
  end
13
15
  end
14
16
 
15
- HashValidator.add_validator(HashValidator::Validator::HexColorValidator.new)
17
+ HashValidator.add_validator(HashValidator::Validator::HexColorValidator.new)
@@ -1,12 +1,14 @@
1
- require 'ipaddr'
1
+ # frozen_string_literal: true
2
+
3
+ require "ipaddr"
2
4
 
3
5
  class HashValidator::Validator::IpValidator < HashValidator::Validator::Base
4
6
  def initialize
5
- super('ip') # The name of the validator
7
+ super("ip") # The name of the validator
6
8
  end
7
9
 
8
10
  def error_message
9
- 'is not a valid IP address'
11
+ "is not a valid IP address"
10
12
  end
11
13
 
12
14
  def valid?(value)
@@ -19,4 +21,4 @@ class HashValidator::Validator::IpValidator < HashValidator::Validator::Base
19
21
  end
20
22
  end
21
23
 
22
- HashValidator.add_validator(HashValidator::Validator::IpValidator.new)
24
+ HashValidator.add_validator(HashValidator::Validator::IpValidator.new)
@@ -1,10 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class HashValidator::Validator::Ipv4Validator < HashValidator::Validator::Base
2
4
  def initialize
3
- super('ipv4') # The name of the validator
5
+ super("ipv4") # The name of the validator
4
6
  end
5
7
 
6
8
  def error_message
7
- 'is not a valid IPv4 address'
9
+ "is not a valid IPv4 address"
8
10
  end
9
11
 
10
12
  def valid?(value)
@@ -15,4 +17,4 @@ class HashValidator::Validator::Ipv4Validator < HashValidator::Validator::Base
15
17
  end
16
18
  end
17
19
 
18
- HashValidator.add_validator(HashValidator::Validator::Ipv4Validator.new)
20
+ HashValidator.add_validator(HashValidator::Validator::Ipv4Validator.new)
@@ -1,12 +1,14 @@
1
- require 'ipaddr'
1
+ # frozen_string_literal: true
2
+
3
+ require "ipaddr"
2
4
 
3
5
  class HashValidator::Validator::Ipv6Validator < HashValidator::Validator::Base
4
6
  def initialize
5
- super('ipv6') # The name of the validator
7
+ super("ipv6") # The name of the validator
6
8
  end
7
9
 
8
10
  def error_message
9
- 'is not a valid IPv6 address'
11
+ "is not a valid IPv6 address"
10
12
  end
11
13
 
12
14
  def valid?(value)
@@ -19,4 +21,4 @@ class HashValidator::Validator::Ipv6Validator < HashValidator::Validator::Base
19
21
  end
20
22
  end
21
23
 
22
- HashValidator.add_validator(HashValidator::Validator::Ipv6Validator.new)
24
+ HashValidator.add_validator(HashValidator::Validator::Ipv6Validator.new)
@@ -1,12 +1,14 @@
1
- require 'json'
1
+ # frozen_string_literal: true
2
+
3
+ require "json"
2
4
 
3
5
  class HashValidator::Validator::JsonValidator < HashValidator::Validator::Base
4
6
  def initialize
5
- super('json') # The name of the validator
7
+ super("json") # The name of the validator
6
8
  end
7
9
 
8
10
  def error_message
9
- 'is not valid JSON'
11
+ "is not valid JSON"
10
12
  end
11
13
 
12
14
  def valid?(value)
@@ -18,4 +20,4 @@ class HashValidator::Validator::JsonValidator < HashValidator::Validator::Base
18
20
  end
19
21
  end
20
22
 
21
- HashValidator.add_validator(HashValidator::Validator::JsonValidator.new)
23
+ HashValidator.add_validator(HashValidator::Validator::JsonValidator.new)
@@ -1,6 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class HashValidator::Validator::LambdaValidator < HashValidator::Validator::Base
2
4
  def initialize
3
- super('_lambda') # The name of the validator, underscored as it won't usually be directly invoked (invoked through use of validator)
5
+ super("_lambda") # The name of the validator, underscored as it won't usually be directly invoked (invoked through use of validator)
4
6
  end
5
7
 
6
8
  def should_validate?(rhs)
@@ -16,7 +18,7 @@ class HashValidator::Validator::LambdaValidator < HashValidator::Validator::Base
16
18
  end
17
19
 
18
20
  def error_message
19
- 'is not valid'
21
+ "is not valid"
20
22
  end
21
23
 
22
24
  def valid?(value, lambda)
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module HashValidator
2
4
  module Validator
3
5
  class ManyValidator < Base
4
6
  def initialize
5
- super('_many') # The name of the validator, underscored as it won't usually be directly invoked (invoked through use of validator)
7
+ super("_many") # The name of the validator, underscored as it won't usually be directly invoked (invoked through use of validator)
6
8
  end
7
9
 
8
10
  def should_validate?(validation)
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module HashValidator
2
4
  module Validator
3
5
  class MultipleValidator < Base
4
6
  def initialize
5
- super('_multiple') # The name of the validator, underscored as it won't usually be directly invoked (invoked through use of validator)
7
+ super("_multiple") # The name of the validator, underscored as it won't usually be directly invoked (invoked through use of validator)
6
8
  end
7
9
 
8
10
  def should_validate?(validation)
@@ -18,7 +20,7 @@ module HashValidator
18
20
  multiple_errors << validation_error[key] if validation_error[key]
19
21
  end
20
22
 
21
- errors[key] = multiple_errors.join(', ') if multiple_errors.any?
23
+ errors[key] = multiple_errors.join(", ") if multiple_errors.any?
22
24
  end
23
25
  end
24
26
  end
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module HashValidator
2
4
  module Validator
3
5
  class OptionalValidator < Base
4
6
  def initialize
5
- super('_optional') # The name of the validator, underscored as it won't usually be directly invoked (invoked through use of validator)
7
+ super("_optional") # The name of the validator, underscored as it won't usually be directly invoked (invoked through use of validator)
6
8
  end
7
9
 
8
10
  def should_validate?(validation)
@@ -1,10 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class HashValidator::Validator::PresenceValidator < HashValidator::Validator::Base
2
4
  def initialize
3
- super('required')
5
+ super("required")
4
6
  end
5
7
 
6
8
  def error_message
7
- 'is required'
9
+ "is required"
8
10
  end
9
11
 
10
12
  def valid?(value)
@@ -1,6 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class HashValidator::Validator::RegexpValidator < HashValidator::Validator::Base
2
4
  def initialize
3
- super('_regex') # The name of the validator, underscored as it won't usually be directly invoked (invoked through use of validator)
5
+ super("_regex") # The name of the validator, underscored as it won't usually be directly invoked (invoked through use of validator)
4
6
  end
5
7
 
6
8
  def should_validate?(rhs)
@@ -8,7 +10,7 @@ class HashValidator::Validator::RegexpValidator < HashValidator::Validator::Base
8
10
  end
9
11
 
10
12
  def error_message
11
- 'does not match regular expression'
13
+ "does not match regular expression"
12
14
  end
13
15
 
14
16
  def valid?(value, regexp)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  [
2
4
  Array,
3
5
  Complex,
@@ -12,6 +14,6 @@
12
14
  Symbol,
13
15
  Time
14
16
  ].each do |type|
15
- name = type.to_s.gsub(/(.)([A-Z])/,'\1_\2').downcase # ActiveSupport/Inflector#underscore behaviour
17
+ name = type.to_s.gsub(/(.)([A-Z])/, '\1_\2').downcase # ActiveSupport/Inflector#underscore behaviour
16
18
  HashValidator.add_validator(HashValidator::Validator::SimpleValidator.new(name, lambda { |v| v.is_a?(type) }))
17
19
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class HashValidator::Validator::SimpleValidator < HashValidator::Validator::Base
2
4
  attr_accessor :lambda
3
5
 
@@ -1,12 +1,14 @@
1
- require 'uri'
1
+ # frozen_string_literal: true
2
+
3
+ require "uri"
2
4
 
3
5
  class HashValidator::Validator::UrlValidator < HashValidator::Validator::Base
4
6
  def initialize
5
- super('url') # The name of the validator
7
+ super("url") # The name of the validator
6
8
  end
7
9
 
8
10
  def error_message
9
- 'is not a valid URL'
11
+ "is not a valid URL"
10
12
  end
11
13
 
12
14
  def valid?(value)
@@ -18,4 +20,4 @@ class HashValidator::Validator::UrlValidator < HashValidator::Validator::Base
18
20
  end
19
21
  end
20
22
 
21
- HashValidator.add_validator(HashValidator::Validator::UrlValidator.new)
23
+ HashValidator.add_validator(HashValidator::Validator::UrlValidator.new)
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module HashValidator
2
4
  @@validators = []
3
5
 
@@ -13,33 +15,33 @@ module HashValidator
13
15
  # Instance-based validator (existing behavior)
14
16
  validator_instance = args[0]
15
17
  unless validator_instance.is_a?(HashValidator::Validator::Base)
16
- raise StandardError.new('validators need to inherit from HashValidator::Validator::Base')
18
+ raise StandardError.new("validators need to inherit from HashValidator::Validator::Base")
17
19
  end
18
20
  validator_instance
19
21
  when 2
20
22
  # Dynamic validator with options
21
23
  name = args[0]
22
24
  options = args[1]
23
-
25
+
24
26
  if options.is_a?(Hash)
25
27
  if options[:pattern]
26
28
  # Pattern-based validator
27
29
  HashValidator::Validator::DynamicPatternValidator.new(name, options[:pattern], options[:error_message])
28
30
  elsif options[:func]
29
- # Function-based validator
31
+ # Function-based validator
30
32
  HashValidator::Validator::DynamicFuncValidator.new(name, options[:func], options[:error_message])
31
33
  else
32
- raise ArgumentError, 'Options hash must contain either :pattern or :func key'
34
+ raise ArgumentError, "Options hash must contain either :pattern or :func key"
33
35
  end
34
36
  else
35
- raise ArgumentError, 'Second argument must be an options hash with :pattern or :func key'
37
+ raise ArgumentError, "Second argument must be an options hash with :pattern or :func key"
36
38
  end
37
39
  else
38
- raise ArgumentError, 'add_validator expects 1 argument (validator instance) or 2 arguments (name, options)'
40
+ raise ArgumentError, "add_validator expects 1 argument (validator instance) or 2 arguments (name, options)"
39
41
  end
40
42
 
41
43
  if @@validators.detect { |v| v.name == validator.name }
42
- raise StandardError.new('validators need to have unique names')
44
+ raise StandardError.new("validators need to have unique names")
43
45
  end
44
46
 
45
47
  @@validators << validator
@@ -54,29 +56,29 @@ module HashValidator
54
56
  end
55
57
 
56
58
  # Load validators
57
- require 'hash_validator/validators/base'
58
- require 'hash_validator/validators/dynamic_pattern_validator'
59
- require 'hash_validator/validators/dynamic_func_validator'
60
- require 'hash_validator/validators/simple_validator'
61
- require 'hash_validator/validators/class_validator'
62
- require 'hash_validator/validators/hash_validator'
63
- require 'hash_validator/validators/presence_validator'
64
- require 'hash_validator/validators/simple_type_validators'
65
- require 'hash_validator/validators/boolean_validator'
66
- require 'hash_validator/validators/email_validator'
67
- require 'hash_validator/validators/enumerable_validator'
68
- require 'hash_validator/validators/regex_validator'
69
- require 'hash_validator/validators/lambda_validator'
70
- require 'hash_validator/validators/optional_validator'
71
- require 'hash_validator/validators/many_validator'
72
- require 'hash_validator/validators/multiple_validator'
73
- require 'hash_validator/validators/array_validator'
74
- require 'hash_validator/validators/url_validator'
75
- require 'hash_validator/validators/json_validator'
76
- require 'hash_validator/validators/hex_color_validator'
77
- require 'hash_validator/validators/alphanumeric_validator'
78
- require 'hash_validator/validators/alpha_validator'
79
- require 'hash_validator/validators/digits_validator'
80
- require 'hash_validator/validators/ipv4_validator'
81
- require 'hash_validator/validators/ipv6_validator'
82
- require 'hash_validator/validators/ip_validator'
59
+ require "hash_validator/validators/base"
60
+ require "hash_validator/validators/dynamic_pattern_validator"
61
+ require "hash_validator/validators/dynamic_func_validator"
62
+ require "hash_validator/validators/simple_validator"
63
+ require "hash_validator/validators/class_validator"
64
+ require "hash_validator/validators/hash_validator"
65
+ require "hash_validator/validators/presence_validator"
66
+ require "hash_validator/validators/simple_type_validators"
67
+ require "hash_validator/validators/boolean_validator"
68
+ require "hash_validator/validators/email_validator"
69
+ require "hash_validator/validators/enumerable_validator"
70
+ require "hash_validator/validators/regex_validator"
71
+ require "hash_validator/validators/lambda_validator"
72
+ require "hash_validator/validators/optional_validator"
73
+ require "hash_validator/validators/many_validator"
74
+ require "hash_validator/validators/multiple_validator"
75
+ require "hash_validator/validators/array_validator"
76
+ require "hash_validator/validators/url_validator"
77
+ require "hash_validator/validators/json_validator"
78
+ require "hash_validator/validators/hex_color_validator"
79
+ require "hash_validator/validators/alphanumeric_validator"
80
+ require "hash_validator/validators/alpha_validator"
81
+ require "hash_validator/validators/digits_validator"
82
+ require "hash_validator/validators/ipv4_validator"
83
+ require "hash_validator/validators/ipv6_validator"
84
+ require "hash_validator/validators/ip_validator"
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module HashValidator
2
- VERSION = '2.0.0'
4
+ VERSION = "2.0.1"
3
5
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module HashValidator
2
4
  def self.validate(*args)
3
5
  Base.validate(*args)
@@ -16,8 +18,8 @@ module HashValidator
16
18
  end
17
19
  end
18
20
 
19
- require 'hash_validator/base'
20
- require 'hash_validator/version'
21
- require 'hash_validator/validators'
22
- require 'hash_validator/validations'
23
- require 'hash_validator/configuration'
21
+ require "hash_validator/base"
22
+ require "hash_validator/version"
23
+ require "hash_validator/validators"
24
+ require "hash_validator/validations"
25
+ require "hash_validator/configuration"