sukima 0.0.2 → 0.0.3

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: d3a1f4531a794d22f40e97a2040a3ceb06c81071a7ed2313c13fa2eec8a6a66b
4
+ data.tar.gz: d0f61856e6a1b96f90a0e31d48365eb8ee93da9bda90be604d98404741438a4d
5
5
  SHA512:
6
- metadata.gz: 8e6fc90236c2bb6e1228cd21bd70da0c1ca7a16e9c16649c9071ce43abe540d4ebf68bd7e5e3b5a7195a10fe177918947626e5b64c9d11b498bc4011a4a6495f
7
- data.tar.gz: 9bf263074fb1f71e679fb24a8d4438282be845b34eece40ec1179b8c5cc0c3052b075ae39ed917f4026fe6f3b477d0ada01bef7980d5469ca7fbd6938b45077d
6
+ metadata.gz: 7995b0ac51c9af4183e7430969d8274d5e31ab181eb911efc36aa2fb072a77ad9156b9b80eee46fb7d55bf75cdc54ee39aac372688ab7d683afed1ef0a686ac9
7
+ data.tar.gz: a2fe41957351e0e1ee95b31a8de3343d8df2db2108db7a54f74f46815287a297dfabb7a060cafd222da562ad4aa21c1e06c7f88968a3fcbf39779d2754eb5811
@@ -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: 0.0.3
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: []