val 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/val.rb +23 -0
  3. metadata +57 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: d0803f1d8b1e7a46060786ab7d0877426986b1dc
4
+ data.tar.gz: 20575e1b85cf0f670d885da5f09439d45ec53d12
5
+ SHA512:
6
+ metadata.gz: 61701f1ed849b74c05c7d272b6148e9a8ec1c21ec1f97f2a537ace68a2dddb6e050eb68a622d2e4d316295da49a57cae7f1a6b4dc1f3230aa991eb05cbfa3d66
7
+ data.tar.gz: d8377455628b76cc4cbab41ab237321e3c0c0ca1f369b59f50659c31da54815c839ecf5f22959c2df723ce941f4be92b9af9fad94c5402186f4834d760ff460e
@@ -0,0 +1,23 @@
1
+ class Val
2
+ require 'to_proc/all'
3
+
4
+ OR = -> *values do
5
+ -> value do
6
+ values.any? &[:===, value]
7
+ end
8
+ end
9
+
10
+ def OR *all
11
+ OR[*all]
12
+ end
13
+
14
+ Bool = new { OR[true, false] }
15
+
16
+ def initialize &block
17
+ @type = instance_exec &block
18
+ end
19
+
20
+ def === value
21
+ @type === value
22
+ end
23
+ end
metadata ADDED
@@ -0,0 +1,57 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: val
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Anatoly Chernow
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-07-29 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: to_proc
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ description:
28
+ email:
29
+ executables: []
30
+ extensions: []
31
+ extra_rdoc_files: []
32
+ files:
33
+ - lib/val.rb
34
+ homepage:
35
+ licenses: []
36
+ metadata: {}
37
+ post_install_message:
38
+ rdoc_options: []
39
+ require_paths:
40
+ - lib
41
+ required_ruby_version: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ required_rubygems_version: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: '0'
51
+ requirements: []
52
+ rubyforge_project:
53
+ rubygems_version: 2.6.11
54
+ signing_key:
55
+ specification_version: 4
56
+ summary: Validate values of Ruby objects.
57
+ test_files: []