ocg 1.1.5 → 1.2.0

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: 016ac48baa4e0b8c5662c14281ef75c5896b7bd2242f05fa6b933a18cd96e083
4
- data.tar.gz: f6aadc294cc4f674ba3df1872abd2d9f3be2e8bb0748d802edbbb7850642ae51
3
+ metadata.gz: 52b0c6aa85ed30a2ae8c65d872e90136d223822fc8d970c26c6515f56ee84b98
4
+ data.tar.gz: 248d46514c8fba336fef0347f5d21d40752651cfc4b3846110e69480f8da02a2
5
5
  SHA512:
6
- metadata.gz: b418ef99dddff5cdb1e8113f02c96f5146a900beac8e7cf67ee167f1dc1f5e1a781d11d7fa91a6830954b1e4dd253f03605c8397cbb43648cdd0fbb5f092f5ac
7
- data.tar.gz: 7eb4d144b1ccc281927a57b7cf7fe27c91f7ac20553deb95ce2510c27358de6f4b1201e9b4f0c879d682e6856bb56f4df8766107e8a91374eba7798db6bd5d0b
6
+ metadata.gz: 15fb346aa655fe3cf505439073ccdd8156c1b341b5ddd38ef4ce7a7e89e4982f2c5ebad4e43ebe3bde8172bd2c46776d9a154db37b2acab94bdcd088df5afb69
7
+ data.tar.gz: 4ff7e04a1684f0c073f0366360d1145e0bdaf9323a6d03ff2c828756bf88c53ecf7eae79b2055f3ccce5605c558b09d6804202d1cdc29d1d069e8b1adc0199f2
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # Option combination generator
2
2
 
3
- | Travis | AppVeyor | Circle | Codecov |
4
- | :---: | :---: | :---: | :---: |
5
- | [![Travis test status](https://travis-ci.com/andrew-aladev/ocg.svg?branch=master)](https://travis-ci.com/andrew-aladev/ocg) | [![AppVeyor test status](https://ci.appveyor.com/api/projects/status/github/andrew-aladev/ocg?branch=master&svg=true)](https://ci.appveyor.com/project/andrew-aladev/ocg/branch/master) | [![Circle test status](https://circleci.com/gh/andrew-aladev/ocg/tree/master.svg?style=shield)](https://circleci.com/gh/andrew-aladev/ocg/tree/master) | [![Codecov](https://codecov.io/gh/andrew-aladev/ocg/branch/master/graph/badge.svg)](https://codecov.io/gh/andrew-aladev/ocg) |
3
+ | Travis | AppVeyor | Circle | Codecov | Gem |
4
+ | :---: | :---: | :---: | :---: | :---: |
5
+ | [![Travis test status](https://travis-ci.com/andrew-aladev/ocg.svg?branch=master)](https://travis-ci.com/andrew-aladev/ocg) | [![AppVeyor test status](https://ci.appveyor.com/api/projects/status/github/andrew-aladev/ocg?branch=master&svg=true)](https://ci.appveyor.com/project/andrew-aladev/ocg/branch/master) | [![Circle test status](https://circleci.com/gh/andrew-aladev/ocg/tree/master.svg?style=shield)](https://circleci.com/gh/andrew-aladev/ocg/tree/master) | [![Codecov](https://codecov.io/gh/andrew-aladev/ocg/branch/master/graph/badge.svg)](https://codecov.io/gh/andrew-aladev/ocg) | [![Gem](https://img.shields.io/gem/v/ocg.svg)](https://rubygems.org/gems/ocg) |
6
6
 
7
7
  ## Installation
8
8
 
@@ -41,7 +41,7 @@ generator = OCG.new(
41
41
  :h => 7..8
42
42
  )
43
43
 
44
- puts generator.next until generator.finished?
44
+ generator.each { |combination| puts combination }
45
45
  ```
46
46
 
47
47
  It will populate all option combinations.
@@ -62,8 +62,8 @@ It will provide all possible option combinations.
62
62
  | `started?` | returns true when at least one combination was generated |
63
63
  | `finished?` | returns true when all combination were generated |
64
64
  | `length` | returns combinations length |
65
- | `to_a` | returns combinations array |
66
65
 
66
+ Generator is responsible to any method from [`Enumerable`](https://ruby-doc.org/core-2.7.2/Enumerable.html).
67
67
  You can combine generators using `and`, `mix` and `or`.
68
68
 
69
69
  Options should be prepared in the following form:
@@ -156,10 +156,10 @@ complete_generator = almost_complete_generator.mix(
156
156
 
157
157
  ## CI
158
158
 
159
- See universal test script [scripts/ci_test.sh](scripts/ci_test.sh) for CI.
160
159
  Please visit [scripts/test-images](scripts/test-images).
161
- You can run this test script using many native and cross images.
160
+ See universal test script [scripts/ci_test.sh](scripts/ci_test.sh) for CI.
161
+ You can run this script using many native and cross images.
162
162
 
163
163
  ## License
164
164
 
165
- MIT license, see LICENSE and AUTHORS.
165
+ MIT license, see [LICENSE](LICENSE) and [AUTHORS](AUTHORS).
@@ -7,6 +7,7 @@ require_relative "error"
7
7
  require_relative "options"
8
8
 
9
9
  class OCG
10
+ include ::Enumerable
10
11
  extend ::Forwardable
11
12
 
12
13
  DELEGATORS = %i[reset next last started? finished? length].freeze
@@ -35,15 +36,14 @@ class OCG
35
36
  Operator::OR.new self, generator_or_options
36
37
  end
37
38
 
38
- def to_a
39
+ def each(&_block)
39
40
  reset
40
41
 
41
- result = []
42
- result << send("next") until finished?
42
+ yield send("next") until finished?
43
43
 
44
44
  reset
45
45
 
46
- result
46
+ nil
47
47
  end
48
48
  end
49
49
 
@@ -2,5 +2,5 @@
2
2
  # Copyright (c) 2019 AUTHORS, MIT License.
3
3
 
4
4
  class OCG
5
- VERSION = "1.1.5".freeze
5
+ VERSION = "1.2.0".freeze
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ocg
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.5
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Aladjev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-09 00:00:00.000000000 Z
11
+ date: 2020-11-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: codecov
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '5.12'
33
+ version: '5.14'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '5.12'
40
+ version: '5.14'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -58,28 +58,28 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0.75'
61
+ version: '0.93'
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: '0.75'
68
+ version: '0.93'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rubocop-performance
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '1.5'
75
+ version: '1.8'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '1.5'
82
+ version: '1.8'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: simplecov
85
85
  requirement: !ruby/object:Gem::Requirement