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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8e9901f2790c6f74257fc4a081df5bbacefb6084fcbd5f1e31c5bf1cd5e69b7f
4
- data.tar.gz: 602a5952e6ece5235fd19b469113903cf4a3750043aa35fdfe5091cb865d4903
3
+ metadata.gz: 407fbf8ade0a64e99df181ec0dde4cb4f5a56f351c00349de8f6988a7734c925
4
+ data.tar.gz: ba84a5d347fea273ce75b7a5430d7af07419490e6fc0168e015c1f5cb28053d7
5
5
  SHA512:
6
- metadata.gz: 683e94067c89e54ffa979c682d40ef6739c8c3a4d92be87a6250cde5c6981498dde7dc42adddb1f78561303954b4344ca7642b15693c616920e6313f589fcb85
7
- data.tar.gz: 10a4f52d299916f8237ccdfa65258a261d1b49811700fc7d73813575a36547aafed3d4ae96686445cc63936b88db90cc3eae7547da335c1589984df9da82fc30
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
- pp generator.next
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 right generator combinations into left without combining. `mix` guarantees that both left and right generator combinations will be provided at least once.
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.
@@ -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"
@@ -2,5 +2,5 @@
2
2
  # Copyright (c) 2019 AUTHORS, MIT License.
3
3
 
4
4
  class OCG
5
- VERSION = "1.0.0".freeze
5
+ VERSION = "1.1.0".freeze
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ocg
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Aladjev