hash_validator 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 204abb59a31b60ea1e62d18d370ff1140f6190e83aa35a989f771fcd4986d5d8
4
- data.tar.gz: 8369e8089adfe5d612bca0596d95594816fc8923216a58a50302ad8cc11a1c51
3
+ metadata.gz: 4074014e1480acf0709f7a6c5c4f444e7a9b740bdb58eb04345fc930e1528f90
4
+ data.tar.gz: 196e0be47b751403869cf47a48f946e63bfd949d88fda63f4f04e57327b1541e
5
5
  SHA512:
6
- metadata.gz: 0663b18d2799515a852b71ef70c69f8153d80c521afbb5fd88904ce8b6d3502fa903c4cb598251eed41e0a287fd69915de535ab49f71c11b04827073625b2e37
7
- data.tar.gz: 23d774f32abb66ad78a6bf63e26dc7533935884792146f6d29cfff50adf7517a8fe5d8d3b20922c4f23c45767a87de42dba2ca9cc56b14477d1302ec5f63ba62
6
+ metadata.gz: 6f121a0d98d4c6e9c825290951cec72985e169a5fd9ef8e69fda5216554a1ae17405a397a0c82041677ae96881c24104fcdf04dc76f9ccf91647207766e739ea
7
+ data.tar.gz: 67b9c1941c04c075c247496d9b69c509c272eaa2f5b633af74fb94e1c9b135149cf76cd8f6a344ad41424804ff224662f353fd65070cc157517a19d4f70ca049
@@ -0,0 +1,27 @@
1
+ name: Test
2
+
3
+ on:
4
+ push:
5
+ branches: [ "master" ]
6
+ pull_request:
7
+ branches: [ "master" ]
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ jobs:
13
+ spec:
14
+ name: "RSpec / Ruby ${{ matrix.ruby }}"
15
+ runs-on: ubuntu-24.04
16
+ strategy:
17
+ fail-fast: false
18
+ matrix:
19
+ ruby: ["2.3", "2.4", "2.5", "2.6", "2.7", "3.0", "3.1", "3.2", "3.3"]
20
+ steps:
21
+ - run: sudo apt-get install libcurl4-openssl-dev
22
+ - uses: actions/checkout@v4
23
+ - uses: ruby/setup-ruby@v1
24
+ with:
25
+ ruby-version: ${{ matrix.ruby }}
26
+ bundler-cache: true
27
+ - run: bundle exec rake spec
data/README.md CHANGED
@@ -1,8 +1,7 @@
1
1
  # Hash Validator
2
2
 
3
3
  [![Gem](https://img.shields.io/gem/v/hash_validator.svg)](https://rubygems.org/gems/hash_validator)
4
- [![Travis](https://travis-ci.org/jamesbrooks/hash_validator.svg)](https://travis-ci.org/jamesbrooks/hash_validator)
5
- [![Coveralls](https://img.shields.io/coveralls/jamesbrooks/hash_validator.svg)](https://coveralls.io/r/jamesbrooks/hash_validator)
4
+ ![Unit Tests](https://github.com/jamesbrooks/hash_validator/actions/workflows/ruby.yml/badge.svg)
6
5
  [![Maintainability](https://api.codeclimate.com/v1/badges/dc6edc1b240860c5f5d9/maintainability)](https://codeclimate.com/github/JamesBrooks/hash_validator/maintainability)
7
6
 
8
7
  Ruby library to validate hashes (Hash) against user-defined requirements
@@ -13,13 +13,13 @@ Gem::Specification.new do |spec|
13
13
  spec.homepage = "https://github.com/JamesBrooks/hash_validator"
14
14
  spec.license = "MIT"
15
15
 
16
- spec.files = `git ls-files`.split($/)
17
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
- spec.require_paths = ["lib"]
16
+ spec.required_ruby_version = ">= 2.0.0"
17
+ spec.files = `git ls-files`.split($/)
18
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
+ spec.require_paths = ["lib"]
20
21
 
21
22
  spec.add_development_dependency 'bundler', '~> 2.1'
22
23
  spec.add_development_dependency 'rake'
23
24
  spec.add_development_dependency 'rspec', '~> 3.10'
24
- spec.add_development_dependency 'coveralls'
25
25
  end
@@ -46,7 +46,21 @@ class HashValidator::Validator::ArrayValidator < HashValidator::Validator::Base
46
46
  return if array_spec.empty?
47
47
 
48
48
  size_spec = array_spec[:size]
49
- if size_spec.present?
49
+
50
+ size_spec_present = case size_spec
51
+ when String
52
+ !object.strip.empty?
53
+ when NilClass
54
+ false
55
+ when Numeric
56
+ true
57
+ when Array, Hash
58
+ !object.empty?
59
+ else
60
+ !!object
61
+ end
62
+
63
+ if size_spec_present
50
64
  unless value.size == size_spec
51
65
  errors[key] = "The required size of array is #{size_spec} but is #{value.size}."
52
66
  return
@@ -1,3 +1,3 @@
1
1
  module HashValidator
2
- VERSION = '1.1.0'
2
+ VERSION = '1.1.1'
3
3
  end
data/spec/spec_helper.rb CHANGED
@@ -1,6 +1,3 @@
1
- require 'coveralls'
2
- Coveralls.wear!
3
-
4
1
  require 'rubygems'
5
2
  require 'hash_validator'
6
3
  require 'hash_validator_spec_helper'
@@ -9,6 +6,6 @@ RSpec.configure do |config|
9
6
  config.run_all_when_everything_filtered = true
10
7
  config.filter_run :focus
11
8
  config.order = 'random'
12
-
9
+
13
10
  config.include HashValidatorSpecHelper
14
11
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hash_validator
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Brooks
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-23 00:00:00.000000000 Z
11
+ date: 2025-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,20 +52,6 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.10'
55
- - !ruby/object:Gem::Dependency
56
- name: coveralls
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
55
  description: Ruby library to validate hashes (Hash) against user-defined requirements
70
56
  email:
71
57
  - james@gooddogdesign.com
@@ -73,10 +59,10 @@ executables: []
73
59
  extensions: []
74
60
  extra_rdoc_files: []
75
61
  files:
62
+ - ".github/workflows/ruby.yml"
76
63
  - ".gitignore"
77
64
  - ".rspec"
78
65
  - ".ruby-version"
79
- - ".travis.yml"
80
66
  - Gemfile
81
67
  - LICENSE.txt
82
68
  - README.md
@@ -135,14 +121,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
135
121
  requirements:
136
122
  - - ">="
137
123
  - !ruby/object:Gem::Version
138
- version: '0'
124
+ version: 2.0.0
139
125
  required_rubygems_version: !ruby/object:Gem::Requirement
140
126
  requirements:
141
127
  - - ">="
142
128
  - !ruby/object:Gem::Version
143
129
  version: '0'
144
130
  requirements: []
145
- rubygems_version: 3.1.2
131
+ rubygems_version: 3.5.23
146
132
  signing_key:
147
133
  specification_version: 4
148
134
  summary: Ruby library to validate hashes (Hash) against user-defined requirements
data/.travis.yml DELETED
@@ -1,5 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.0.0
4
- - 2.6.6
5
- - 2.7.2