ocg 1.1.3 → 1.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +23 -28
- data/lib/ocg/operator/abstract.rb +1 -1
- data/lib/ocg/version.rb +1 -1
- metadata +4 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59aa6a751c46f2c5df99170cbc90b6d588a31cd6c58c0c1442405545346196e6
|
4
|
+
data.tar.gz: 51ad926c4f636f950e478537d68694743997d5edbc510d801163666819dc18b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e369db994e082505ac85c156a0c92801e14a148ee1c139be7a9edf7834cb6bbcf13534638d33ebb848de8edb455afca054ac8efe21f5b1882f54238f3a379cb
|
7
|
+
data.tar.gz: '0729c7969f7d29adf70a3ef0a03ba65f4cb2b11092cafc8e963532d82f145b9f61a466a9e622ba57e573272ec1c138bd6ca0155c13ff083b1aac04ccd6f7e29a'
|
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# Option combination generator
|
2
2
|
|
3
|
-
| Travis | AppVeyor |
|
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) | [![
|
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) |
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
@@ -17,6 +17,8 @@ rake gem
|
|
17
17
|
gem install pkg/ocg-*.gem
|
18
18
|
```
|
19
19
|
|
20
|
+
You can also use [overlay](https://github.com/andrew-aladev/overlay) for gentoo.
|
21
|
+
|
20
22
|
## Usage
|
21
23
|
|
22
24
|
```ruby
|
@@ -46,6 +48,24 @@ It will populate all option combinations.
|
|
46
48
|
|
47
49
|
## Docs
|
48
50
|
|
51
|
+
`OCG.new options` will prepare a generator.
|
52
|
+
It will provide all possible option combinations.
|
53
|
+
|
54
|
+
| Method | Description |
|
55
|
+
|-------------|-------------|
|
56
|
+
| `and` | provides all combinations between generators |
|
57
|
+
| `mix` | merges combinations without combining, guarantees that both left and right generator combinations will be provided at least once |
|
58
|
+
| `or` | concats generator combinations without merging |
|
59
|
+
| `reset` | allows to receive combinations once again |
|
60
|
+
| `next` | returns next combination |
|
61
|
+
| `last` | returns last combination |
|
62
|
+
| `started?` | returns true when at least one combination was generated |
|
63
|
+
| `finished?` | returns true when all combination were generated |
|
64
|
+
| `length` | returns combinations length |
|
65
|
+
| `to_a` | returns combinations array |
|
66
|
+
|
67
|
+
You can combine generators using `and`, `mix` and `or`.
|
68
|
+
|
49
69
|
Options should be prepared in the following form:
|
50
70
|
|
51
71
|
```ruby
|
@@ -60,29 +80,6 @@ Options hash should not be empty.
|
|
60
80
|
`option_values` should be convertable to array using `to_a`.
|
61
81
|
`option_values` should not be empty.
|
62
82
|
|
63
|
-
`OCG.new options` will prepare a generator.
|
64
|
-
It will provide all possible option combinations.
|
65
|
-
|
66
|
-
You can combine generators using `and`, `mix` and `or`.
|
67
|
-
|
68
|
-
`and` method will provide all combinations between generators.
|
69
|
-
`mix` method will merge combinations without combining. `mix` guarantees that both left and right generator combinations will be provided at least once.
|
70
|
-
`or` method will concat generator combinations without merging.
|
71
|
-
|
72
|
-
`reset` method allows to receive combinations once again.
|
73
|
-
|
74
|
-
`next` method returns next combination.
|
75
|
-
|
76
|
-
`last` method returns last combination.
|
77
|
-
|
78
|
-
`started?` method returns true when at least one combination was generated.
|
79
|
-
|
80
|
-
`finished?` method returns true when all combination were generated.
|
81
|
-
|
82
|
-
`length` returns combinations length.
|
83
|
-
|
84
|
-
`to_a` returns combinations array.
|
85
|
-
|
86
83
|
## Why?
|
87
84
|
|
88
85
|
Many software uses multiple options and have complex relations between them.
|
@@ -163,8 +160,6 @@ See universal test script [scripts/ci_test.sh](scripts/ci_test.sh) for CI.
|
|
163
160
|
Please visit [scripts/test-images](scripts/test-images).
|
164
161
|
You can run this test script using many native and cross images.
|
165
162
|
|
166
|
-
Cirrus CI uses `x86_64-pc-linux-gnu` image, Circle CI - `x86_64-gentoo-linux-musl` image.
|
167
|
-
|
168
163
|
## License
|
169
164
|
|
170
165
|
MIT license, see LICENSE and AUTHORS.
|
@@ -6,7 +6,7 @@ require_relative "../error"
|
|
6
6
|
class OCG
|
7
7
|
module Operator
|
8
8
|
class Abstract < OCG
|
9
|
-
def initialize(left_generator_or_options, right_generator_or_options)
|
9
|
+
def initialize(left_generator_or_options, right_generator_or_options) # rubocop:disable Lint/MissingSuper
|
10
10
|
@left_generator = OCG.prepare_generator left_generator_or_options
|
11
11
|
@right_generator = OCG.prepare_generator right_generator_or_options
|
12
12
|
|
data/lib/ocg/version.rb
CHANGED
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.
|
4
|
+
version: 1.1.4
|
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-
|
11
|
+
date: 2020-10-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: codecov
|
@@ -80,20 +80,6 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '1.5'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: rubocop-rails
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '2.3'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '2.3'
|
97
83
|
- !ruby/object:Gem::Dependency
|
98
84
|
name: simplecov
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -137,9 +123,9 @@ require_paths:
|
|
137
123
|
- lib
|
138
124
|
required_ruby_version: !ruby/object:Gem::Requirement
|
139
125
|
requirements:
|
140
|
-
- - "
|
126
|
+
- - "~>"
|
141
127
|
- !ruby/object:Gem::Version
|
142
|
-
version: '
|
128
|
+
version: '2.7'
|
143
129
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
144
130
|
requirements:
|
145
131
|
- - ">="
|