limit_detectors 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +32 -0
- data/README.md +19 -9
- data/lib/limit_detectors/version.rb +1 -1
- data/limit_detectors.gemspec +5 -2
- metadata +10 -9
- data/.travis.yml +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4e23840f749e25f3a9a56bc29c20b4b6f2a6f2a633e7b966e79de77d7f7bb5c
|
4
|
+
data.tar.gz: c44f8e6ba2e29afcd9380fcb386a9b4fe221628b75ef07dba340e3b115883467
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20ae2e520b58d17b2c56a0499988c3b6548a652866bc666c5096119a10741136783010bb18fde7ecf12840199d1c854e86949a3b252f5139c9169cb097477d30
|
7
|
+
data.tar.gz: ade449cf503a0cf86ca8696a309765485db269575608d3efcd339a32a55bf762f3deb0e208090a8b4a91c7f3ecee1d04b5279cf027de01768e45e400a4ba8d86
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# This workflow uses actions that are not certified by GitHub.
|
2
|
+
# They are provided by a third-party and are governed by
|
3
|
+
# separate terms of service, privacy policy, and support
|
4
|
+
# documentation.
|
5
|
+
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
6
|
+
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
7
|
+
|
8
|
+
name: Ruby
|
9
|
+
|
10
|
+
on:
|
11
|
+
push:
|
12
|
+
branches: [ main ]
|
13
|
+
pull_request:
|
14
|
+
branches: [ main ]
|
15
|
+
|
16
|
+
jobs:
|
17
|
+
test:
|
18
|
+
|
19
|
+
runs-on: ubuntu-latest
|
20
|
+
strategy:
|
21
|
+
matrix:
|
22
|
+
ruby-version: ['2.7', '3.0', '3.1', 'jruby', 'truffleruby']
|
23
|
+
|
24
|
+
steps:
|
25
|
+
- uses: actions/checkout@v2
|
26
|
+
- name: Set up Ruby
|
27
|
+
uses: ruby/setup-ruby@v1
|
28
|
+
with:
|
29
|
+
ruby-version: ${{ matrix.ruby-version }}
|
30
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
31
|
+
- name: Run tests
|
32
|
+
run: bundle exec rake
|
data/README.md
CHANGED
@@ -4,9 +4,11 @@ Some methods to detect whether an Enumberable object contains a constrained numb
|
|
4
4
|
|
5
5
|
A second reason to create this gem is to explore various other services -- see the status list below.
|
6
6
|
|
7
|
-
|
7
|
+
|
8
|
+
## Status & Links
|
8
9
|
|
9
10
|
* Version: [![Gem Version](https://badge.fury.io/rb/limit_detectors.svg)](http://badge.fury.io/rb/limit_detectors)
|
11
|
+
* GitHub Actions: [![Main workflow: unit tests](https://github.com/s2k/limit_detectors/actions/workflows/ruby.yml/badge.svg)](https://github.com/s2k/limit_detectors/actions)
|
10
12
|
* Travis CI: [![Build Status](https://travis-ci.com/s2k/limit_detectors.svg?branch=main)](https://travis-ci.com/s2k/limit_detectors)
|
11
13
|
* Code Climate: [![Maintainability](https://api.codeclimate.com/v1/badges/f29deb5bcd4e2ad44d25/maintainability)](https://codeclimate.com/github/s2k/limit_detectors/maintainability)
|
12
14
|
|
@@ -25,6 +27,7 @@ Or install it yourself as:
|
|
25
27
|
|
26
28
|
$ gem install limit_detectors
|
27
29
|
|
30
|
+
|
28
31
|
## Usage
|
29
32
|
|
30
33
|
In your code, you can `require 'limit_detectors'` then define your classes and `include` module `LimitDetectors` in your class, or create enumerable objects and `extend` these objects with `LimitDetectors`. Then call `at_most?` (or `t_least?`) on your object.
|
@@ -32,14 +35,21 @@ In your code, you can `require 'limit_detectors'` then define your classes and `
|
|
32
35
|
For example using `pry`(you can use `irb` as well) you can do this:
|
33
36
|
|
34
37
|
```ruby
|
35
|
-
|
38
|
+
[3] pry(main)> a.at_most?(4){|e| e.odd?}
|
39
|
+
=> true # There are indeed no more than 4 odd numbers in the array
|
40
|
+
[4] pry(main)> a.at_most?(1){|e| e.even?}
|
41
|
+
=> false # In fact there are two even numbers in the array
|
42
|
+
|
43
|
+
$ pry -I lib -r limit_detectors
|
36
44
|
[1] pry(main)> a = [1, 2, 3, 4, 5]
|
37
45
|
=> [1, 2, 3, 4, 5]
|
38
46
|
[2] pry(main)> a.extend LimitDetectors
|
39
47
|
=> [1, 2, 3, 4, 5]
|
40
48
|
[3] pry(main)> a.at_most?(4){|e| e.odd?}
|
41
49
|
=> true # There are indeed no more than 4 odd numbers in the array
|
42
|
-
[4] pry(main)> a.at_most?(
|
50
|
+
[4] pry(main)> a.at_most?(4, &:odd?)
|
51
|
+
=> true # The same behaviour using a different notation
|
52
|
+
[5] pry(main)> a.at_most?(1){|e| e.even?}
|
43
53
|
=> false # In fact there are two even numbers in the array
|
44
54
|
```
|
45
55
|
|
@@ -66,16 +76,15 @@ puts e.at_most?(42) { |c| 'b' == c }
|
|
66
76
|
```
|
67
77
|
|
68
78
|
|
69
|
-
|
70
79
|
## Compatibility
|
71
80
|
|
72
81
|
This gem is tested with these Ruby versions (MRI, unless JRuby):
|
73
82
|
|
74
|
-
- 2.
|
75
|
-
-
|
76
|
-
- 3.
|
83
|
+
- 2.7
|
84
|
+
- 3.0
|
85
|
+
- 3.1
|
77
86
|
|
78
|
-
as well as a current version of JRuby
|
87
|
+
as well as a current version of JRuby and TruffleRuby
|
79
88
|
|
80
89
|
## Contributing
|
81
90
|
|
@@ -85,7 +94,8 @@ as well as a current version of JRuby.
|
|
85
94
|
4. Push to the branch (`git push origin my-new-feature`)
|
86
95
|
5. Create a new Pull Request
|
87
96
|
|
88
|
-
A more detailed
|
97
|
+
A more detailed description is at https://opensource.com/article/19/7/create-pull-request-github
|
98
|
+
|
89
99
|
|
90
100
|
### Reporting a bug
|
91
101
|
|
data/limit_detectors.gemspec
CHANGED
@@ -21,7 +21,10 @@ Gem::Specification.new do |spec|
|
|
21
21
|
|
22
22
|
spec.add_development_dependency 'bundler'
|
23
23
|
spec.add_development_dependency 'pry', '~> 0.14.1'
|
24
|
-
spec.add_development_dependency 'pry-doc', '~> 1.
|
25
|
-
spec.add_development_dependency 'rake', '~> 13.0.
|
24
|
+
spec.add_development_dependency 'pry-doc', '~> 1.2.0'
|
25
|
+
spec.add_development_dependency 'rake', '~> 13.0.6'
|
26
26
|
spec.add_development_dependency 'rspec', '~> 3.10'
|
27
|
+
spec.metadata = {
|
28
|
+
'rubygems_mfa_required' => 'true'
|
29
|
+
}
|
27
30
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: limit_detectors
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephan Kämper
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -44,28 +44,28 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 1.
|
47
|
+
version: 1.2.0
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.
|
54
|
+
version: 1.2.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 13.0.
|
61
|
+
version: 13.0.6
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 13.0.
|
68
|
+
version: 13.0.6
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -88,10 +88,10 @@ executables: []
|
|
88
88
|
extensions: []
|
89
89
|
extra_rdoc_files: []
|
90
90
|
files:
|
91
|
+
- ".github/workflows/ruby.yml"
|
91
92
|
- ".gitignore"
|
92
93
|
- ".rspec"
|
93
94
|
- ".rubocop.yml"
|
94
|
-
- ".travis.yml"
|
95
95
|
- Gemfile
|
96
96
|
- LICENSE.txt
|
97
97
|
- README.md
|
@@ -105,7 +105,8 @@ files:
|
|
105
105
|
homepage: ''
|
106
106
|
licenses:
|
107
107
|
- MIT
|
108
|
-
metadata:
|
108
|
+
metadata:
|
109
|
+
rubygems_mfa_required: 'true'
|
109
110
|
post_install_message:
|
110
111
|
rdoc_options: []
|
111
112
|
require_paths:
|
@@ -121,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
121
122
|
- !ruby/object:Gem::Version
|
122
123
|
version: '0'
|
123
124
|
requirements: []
|
124
|
-
rubygems_version: 3.
|
125
|
+
rubygems_version: 3.3.4
|
125
126
|
signing_key:
|
126
127
|
specification_version: 4
|
127
128
|
summary: Detect certain conditions of elements of an Enumerable object
|