sukima 0.0.2 → 1.0.0

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: 17d51cc1b8a68838a9778650d99d537f259266be3236a7e40a3c31c4010070ca
4
- data.tar.gz: 410d6a41f2afc28ca7acbe47aae6af0b8e650703e352cee27b49849713662d9c
3
+ metadata.gz: 4f926d8ce3a8c9b721ba62bc5b89f0b4190ab90ca0064a43dfa847d817165705
4
+ data.tar.gz: 53f9938c869ff66d7a205af5fe4f1371d7c9a49dcf03ac56794eebc9d4f972ba
5
5
  SHA512:
6
- metadata.gz: 8e6fc90236c2bb6e1228cd21bd70da0c1ca7a16e9c16649c9071ce43abe540d4ebf68bd7e5e3b5a7195a10fe177918947626e5b64c9d11b498bc4011a4a6495f
7
- data.tar.gz: 9bf263074fb1f71e679fb24a8d4438282be845b34eece40ec1179b8c5cc0c3052b075ae39ed917f4026fe6f3b477d0ada01bef7980d5469ca7fbd6938b45077d
6
+ metadata.gz: 4f4b61b76b908ccf6be11ec64b67ee583a81053d364e8bd615a83c6eb75580e7805911dec510ea4ea6f2d38e2b743f5a31d204564cc98984c74ba671ba4736cf
7
+ data.tar.gz: f5c3d84bfa1cf1c1993ea3b6238e310858b214e51970d6eceed69c1c2d882e90af1eae8607a3fd39b48e1588467960c724fbcc9bdc1664b72247058493267eba
@@ -4,7 +4,7 @@ class Sukima
4
4
  module Constraints
5
5
  class << self
6
6
  def type(type, value)
7
- "should be #{type}" unless value.nil? || value.is_a?(type)
7
+ "should be #{type}" unless value.is_a?(type)
8
8
  end
9
9
 
10
10
  def in(range, value)
data/lib/sukima.rb CHANGED
@@ -14,6 +14,8 @@ class Sukima
14
14
 
15
15
  def validate(value)
16
16
  error_field = ErrorField.new
17
+ return error_field if !@constraints[:nonnil] && value.nil?
18
+
17
19
  @constraints.each do |key, args|
18
20
  next if key == :required
19
21
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sukima
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Weihang Jian
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-30 00:00:00.000000000 Z
11
+ date: 2024-07-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -67,7 +67,7 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1.64'
69
69
  description: Sukima is a lightweight data schema validation library for Ruby written
70
- in only 100+ lines of code. It provides a simple and flexible way to define constraints
70
+ in only ~100 lines of code. It provides a simple and flexible way to define constraints
71
71
  for data and validate it.
72
72
  email: tonytonyjan@gmail.com
73
73
  executables: []