limit_detectors 1.0.1 → 1.0.5
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 -10
- data/checksums/limit_detectors-1.0.2.gem.sha512 +1 -0
- data/checksums/limit_detectors-1.0.3.gem.sha512 +1 -0
- data/checksums/limit_detectors-1.0.4.gem.sha512 +1 -0
- data/lib/limit_detectors/version.rb +1 -1
- data/limit_detectors.gemspec +5 -2
- metadata +13 -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: 5fb4453afdc0739cbb2830c335ff1295b840cd255b4140e412c4c1ba2bfacb16
|
4
|
+
data.tar.gz: 48751806a06f0ad01f152cb532062dd9b50761cfbc6114f88542928caf0f89d3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1c3150eece7035d6fa2edf3009d420e0476ec01aedd48924192e839aa846170b64c57c1ced37cc67fe6081d1b8849bd32cc1abd96e06450318f4db9f09cdd112
|
7
|
+
data.tar.gz: a317efdedcce1a0f8b6f26a2f7ae6b89bd1195866d1bae83241cca83127906b21955c6ca54e6fb4d3d1414e51ee75060e9d1ecff6fb4686d59b8044c05f07681
|
@@ -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,10 +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)
|
10
|
-
*
|
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)
|
11
12
|
* Code Climate: [![Maintainability](https://api.codeclimate.com/v1/badges/f29deb5bcd4e2ad44d25/maintainability)](https://codeclimate.com/github/s2k/limit_detectors/maintainability)
|
12
13
|
|
13
14
|
|
@@ -25,6 +26,7 @@ Or install it yourself as:
|
|
25
26
|
|
26
27
|
$ gem install limit_detectors
|
27
28
|
|
29
|
+
|
28
30
|
## Usage
|
29
31
|
|
30
32
|
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 +34,21 @@ In your code, you can `require 'limit_detectors'` then define your classes and `
|
|
32
34
|
For example using `pry`(you can use `irb` as well) you can do this:
|
33
35
|
|
34
36
|
```ruby
|
35
|
-
|
37
|
+
[3] pry(main)> a.at_most?(4){|e| e.odd?}
|
38
|
+
=> true # There are indeed no more than 4 odd numbers in the array
|
39
|
+
[4] pry(main)> a.at_most?(1){|e| e.even?}
|
40
|
+
=> false # In fact there are two even numbers in the array
|
41
|
+
|
42
|
+
$ pry -I lib -r limit_detectors
|
36
43
|
[1] pry(main)> a = [1, 2, 3, 4, 5]
|
37
44
|
=> [1, 2, 3, 4, 5]
|
38
45
|
[2] pry(main)> a.extend LimitDetectors
|
39
46
|
=> [1, 2, 3, 4, 5]
|
40
47
|
[3] pry(main)> a.at_most?(4){|e| e.odd?}
|
41
48
|
=> true # There are indeed no more than 4 odd numbers in the array
|
42
|
-
[4] pry(main)> a.at_most?(
|
49
|
+
[4] pry(main)> a.at_most?(4, &:odd?)
|
50
|
+
=> true # The same behaviour using a different notation
|
51
|
+
[5] pry(main)> a.at_most?(1){|e| e.even?}
|
43
52
|
=> false # In fact there are two even numbers in the array
|
44
53
|
```
|
45
54
|
|
@@ -66,16 +75,15 @@ puts e.at_most?(42) { |c| 'b' == c }
|
|
66
75
|
```
|
67
76
|
|
68
77
|
|
69
|
-
|
70
78
|
## Compatibility
|
71
79
|
|
72
80
|
This gem is tested with these Ruby versions (MRI, unless JRuby):
|
73
81
|
|
74
|
-
- 2.
|
75
|
-
-
|
76
|
-
- 3.
|
82
|
+
- 2.7
|
83
|
+
- 3.0
|
84
|
+
- 3.1
|
77
85
|
|
78
|
-
as well as a current version of JRuby
|
86
|
+
as well as a current version of JRuby and TruffleRuby
|
79
87
|
|
80
88
|
## Contributing
|
81
89
|
|
@@ -85,7 +93,8 @@ as well as a current version of JRuby.
|
|
85
93
|
4. Push to the branch (`git push origin my-new-feature`)
|
86
94
|
5. Create a new Pull Request
|
87
95
|
|
88
|
-
A more detailed
|
96
|
+
A more detailed description is at https://opensource.com/article/19/7/create-pull-request-github
|
97
|
+
|
89
98
|
|
90
99
|
### Reporting a bug
|
91
100
|
|
@@ -0,0 +1 @@
|
|
1
|
+
99d4f0e4ec4d0b8b5cd4aadbd4e163d8d8d24de394061aa94d030d9149cf3f8e7420a8a9c46a3ec1c2036573c83b45a74a2c7f6f6ff51ae9539a0170164281ab
|
@@ -0,0 +1 @@
|
|
1
|
+
16082d01316b0e5b34dbaf6ceacfcb94b5ed95aa46de740bb7272d03cac20ee2bfdcc71f290c2da1b7eb1c2aeaee0635760d37f257610c03ec02895a73c7d6e3
|
@@ -0,0 +1 @@
|
|
1
|
+
97b5ec7acfdea83cdf0d55e3eff98ea27fc729fa95c56ee4599f7651140c1c872e140a1cf50f6c1da8b4f538dfd0a7b202a30e643b4d510dc62fbb277d211217
|
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.5
|
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,14 +88,17 @@ 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
|
98
98
|
- Rakefile
|
99
|
+
- checksums/limit_detectors-1.0.2.gem.sha512
|
100
|
+
- checksums/limit_detectors-1.0.3.gem.sha512
|
101
|
+
- checksums/limit_detectors-1.0.4.gem.sha512
|
99
102
|
- example/example.rb
|
100
103
|
- lib/limit_detectors.rb
|
101
104
|
- lib/limit_detectors/version.rb
|
@@ -105,7 +108,8 @@ files:
|
|
105
108
|
homepage: ''
|
106
109
|
licenses:
|
107
110
|
- MIT
|
108
|
-
metadata:
|
111
|
+
metadata:
|
112
|
+
rubygems_mfa_required: 'true'
|
109
113
|
post_install_message:
|
110
114
|
rdoc_options: []
|
111
115
|
require_paths:
|
@@ -121,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
121
125
|
- !ruby/object:Gem::Version
|
122
126
|
version: '0'
|
123
127
|
requirements: []
|
124
|
-
rubygems_version: 3.
|
128
|
+
rubygems_version: 3.3.4
|
125
129
|
signing_key:
|
126
130
|
specification_version: 4
|
127
131
|
summary: Detect certain conditions of elements of an Enumerable object
|