kind 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +16 -2
- data/Gemfile +1 -0
- data/README.md +27 -16
- data/kind.gemspec +2 -2
- data/lib/kind/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db734da8b7d777098f049983dce40d7a0f36d6a6d9c61ade223275c5d023c22e
|
4
|
+
data.tar.gz: 0e1dea80ac9fdebdf2af1e0a6becd1aa970294906e5f5f8cd7c8836a9c4dc5f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96346a48789ccc9fcd7a0308eca390753bc3b8e397a048c7bb049929252214c7ba6d100ae17fb14a1e98595817120aa8c4900d57a4638bc8ee9494eb8682b259
|
7
|
+
data.tar.gz: 07410f5ec41a04cfaaaf660f1ad933e238efb1b2845b7e11c2ba69602c31bd69517ece4d3056c1e62b4c89faa04824344cdd8634ba593470c48b227bc7a9e8c8
|
data/.travis.yml
CHANGED
@@ -1,6 +1,20 @@
|
|
1
1
|
---
|
2
2
|
language: ruby
|
3
|
+
|
3
4
|
cache: bundler
|
5
|
+
|
4
6
|
rvm:
|
5
|
-
- 2.
|
6
|
-
|
7
|
+
- 2.2.0
|
8
|
+
- 2.3.0
|
9
|
+
- 2.4.0
|
10
|
+
- 2.5.0
|
11
|
+
- 2.6.0
|
12
|
+
- 2.7.0
|
13
|
+
|
14
|
+
before_install:
|
15
|
+
- gem uninstall -v '>= 2' -i $(rvm gemdir)@global -ax bundler || true
|
16
|
+
- gem install bundler -v '< 2'
|
17
|
+
|
18
|
+
install: bundle install --jobs=3 --retry=3
|
19
|
+
|
20
|
+
script: bundle exec rake test
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,19 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
- [Verifying the kind of some class/module](#verifying-the-kind-of-some-classmodule)
|
6
|
-
- [Built-in type checkers](#built-in-type-checkers)
|
7
|
-
- [Special type checkers](#special-type-checkers)
|
8
|
-
- [Kind.of](#kindof)
|
9
|
-
- [Kind.is](#kindis)
|
10
|
-
- [How to create a new type checker?](#how-to-create-a-new-type-checker)
|
11
|
-
- [Development](#development)
|
12
|
-
- [Contributing](#contributing)
|
13
|
-
- [License](#license)
|
14
|
-
- [Code of Conduct](#code-of-conduct)
|
15
|
-
|
16
|
-
# Kind
|
1
|
+
[![Gem](https://img.shields.io/gem/v/kind.svg?style=flat-square)](https://rubygems.org/gems/kind)
|
2
|
+
[![Build Status](https://travis-ci.com/serradura/kind.svg?branch=master)](https://travis-ci.com/serradura/kind)
|
3
|
+
|
4
|
+
# Kind <!-- omit in toc -->
|
17
5
|
|
18
6
|
Basic type system for Ruby.
|
19
7
|
|
@@ -23,6 +11,21 @@ As a creator of Ruby gems, I have a common need that I have to handle in many of
|
|
23
11
|
|
24
12
|
One of the goals of this project is to do simple type checking like `"some string".is_a?(String)`, but using a bunch of basic abstractions. So, after reading this README and realizing that you need something more robust, I recommend to you check out the [dry-types gem](https://dry-rb.org/gems/dry-types).
|
25
13
|
|
14
|
+
## Table of Contents <!-- omit in toc -->
|
15
|
+
- [Installation](#installation)
|
16
|
+
- [Usage](#usage)
|
17
|
+
- [Verifying the kind of some object](#verifying-the-kind-of-some-object)
|
18
|
+
- [Verifying the kind of some class/module](#verifying-the-kind-of-some-classmodule)
|
19
|
+
- [Built-in type checkers](#built-in-type-checkers)
|
20
|
+
- [Special type checkers](#special-type-checkers)
|
21
|
+
- [Kind.of](#kindof)
|
22
|
+
- [Kind.is](#kindis)
|
23
|
+
- [How to create a new type checker?](#how-to-create-a-new-type-checker)
|
24
|
+
- [Development](#development)
|
25
|
+
- [Contributing](#contributing)
|
26
|
+
- [License](#license)
|
27
|
+
- [Code of Conduct](#code-of-conduct)
|
28
|
+
|
26
29
|
## Installation
|
27
30
|
|
28
31
|
Add this line to your application's Gemfile:
|
@@ -39,6 +42,8 @@ Or install it yourself as:
|
|
39
42
|
|
40
43
|
$ gem install kind
|
41
44
|
|
45
|
+
[⬆️ Back to Top](#table-of-contents-)
|
46
|
+
|
42
47
|
## Usage
|
43
48
|
|
44
49
|
### Verifying the kind of some object
|
@@ -116,6 +121,8 @@ Kind.of.Hash.class?(ActiveSupport::HashWithIndifferentAccess)
|
|
116
121
|
# true
|
117
122
|
```
|
118
123
|
|
124
|
+
[⬆️ Back to Top](#table-of-contents-)
|
125
|
+
|
119
126
|
## Built-in type checkers
|
120
127
|
|
121
128
|
The list of types (classes and modules) available to use with `Kind.of.*` or `Kind.is.*` are:
|
@@ -154,6 +161,8 @@ The list of types (classes and modules) available to use with `Kind.of.*` or `Ki
|
|
154
161
|
- `Kind.of.Module()`
|
155
162
|
- `Kind.of.Boolean()`
|
156
163
|
|
164
|
+
[⬆️ Back to Top](#table-of-contents-)
|
165
|
+
|
157
166
|
## How to create a new type checker?
|
158
167
|
|
159
168
|
Use `Kind::Types.add()`. e.g:
|
@@ -192,6 +201,8 @@ Kind.of.User.instance?(User) # true
|
|
192
201
|
Kind.of.User.class?(User) # true
|
193
202
|
```
|
194
203
|
|
204
|
+
[⬆️ Back to Top](#table-of-contents-)
|
205
|
+
|
195
206
|
## Development
|
196
207
|
|
197
208
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/kind.gemspec
CHANGED
@@ -7,10 +7,10 @@ Gem::Specification.new do |spec|
|
|
7
7
|
spec.email = ['rodrigo.serradura@gmail.com']
|
8
8
|
|
9
9
|
spec.summary = %q{Basic type system for Ruby.}
|
10
|
-
spec.description = %q{Basic type system for Ruby.}
|
10
|
+
spec.description = %q{Basic type system for Ruby (free of dependencies).}
|
11
11
|
spec.homepage = 'https://github.com/serradura/kind'
|
12
12
|
spec.license = 'MIT'
|
13
|
-
spec.required_ruby_version = Gem::Requirement.new('>= 2.
|
13
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.2.0')
|
14
14
|
|
15
15
|
spec.metadata['homepage_uri'] = spec.homepage
|
16
16
|
spec.metadata['source_code_uri'] = 'https://github.com/serradura/kind'
|
data/lib/kind/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kind
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rodrigo Serradura
|
@@ -10,7 +10,7 @@ bindir: exe
|
|
10
10
|
cert_chain: []
|
11
11
|
date: 2020-01-03 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description: Basic type system for Ruby.
|
13
|
+
description: Basic type system for Ruby (free of dependencies).
|
14
14
|
email:
|
15
15
|
- rodrigo.serradura@gmail.com
|
16
16
|
executables: []
|
@@ -43,7 +43,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
43
43
|
requirements:
|
44
44
|
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: 2.
|
46
|
+
version: 2.2.0
|
47
47
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
48
48
|
requirements:
|
49
49
|
- - ">="
|