ocg 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +4 -2
- data/lib/ocg/main.rb +11 -0
- data/lib/ocg/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 407fbf8ade0a64e99df181ec0dde4cb4f5a56f351c00349de8f6988a7734c925
|
4
|
+
data.tar.gz: ba84a5d347fea273ce75b7a5430d7af07419490e6fc0168e015c1f5cb28053d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5027cffb24ee8fb5ea204a589cdd1dcebb21f123381f1b42c1c883968f1486901e8ac14b4b183dc4dac11237dcbbd9eb442e0ee4d823ff9ad7b73cc6a8f1805
|
7
|
+
data.tar.gz: 23aec63119a3b2e37bedb47478e4ae4db5efe179624725baee7505a76d3f1cf503b41252ecc258e6e4c1e2a1c69fd777c301e7e573ba0d81763beb3dc0325b5e
|
data/README.md
CHANGED
@@ -41,7 +41,7 @@ generator = OCG.new(
|
|
41
41
|
)
|
42
42
|
|
43
43
|
until generator.finished?
|
44
|
-
|
44
|
+
puts generator.next
|
45
45
|
end
|
46
46
|
```
|
47
47
|
|
@@ -69,7 +69,7 @@ It will provide all possible option combinations.
|
|
69
69
|
You can combine generators using `and`, `mix` and `or`.
|
70
70
|
|
71
71
|
`and` method will provide all combinations between generators.
|
72
|
-
`mix` method will merge
|
72
|
+
`mix` method will merge combinations without combining. `mix` guarantees that both left and right generator combinations will be provided at least once.
|
73
73
|
`or` method will concat generator combinations without merging.
|
74
74
|
|
75
75
|
`reset` method allows to receive combinations once again.
|
@@ -84,6 +84,8 @@ You can combine generators using `and`, `mix` and `or`.
|
|
84
84
|
|
85
85
|
`length` returns combinations length.
|
86
86
|
|
87
|
+
`to_a` returns combinations array.
|
88
|
+
|
87
89
|
## Why?
|
88
90
|
|
89
91
|
Many software uses multiple options and have complex relations between them.
|
data/lib/ocg/main.rb
CHANGED
@@ -34,6 +34,17 @@ class OCG
|
|
34
34
|
def or(generator_or_options)
|
35
35
|
Operator::OR.new self, generator_or_options
|
36
36
|
end
|
37
|
+
|
38
|
+
def to_a
|
39
|
+
reset
|
40
|
+
|
41
|
+
result = []
|
42
|
+
result << send("next") until finished?
|
43
|
+
|
44
|
+
reset
|
45
|
+
|
46
|
+
result
|
47
|
+
end
|
37
48
|
end
|
38
49
|
|
39
50
|
require_relative "operator/and"
|
data/lib/ocg/version.rb
CHANGED