sum_all_number_combinations 0.1.0 → 0.1.1

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
  SHA1:
3
- metadata.gz: 83aedb673494ae05121f8a1d8c521512354b1dbc
4
- data.tar.gz: b8e5b0a6aed87ff90bdae4a284d4cc51a77ca5fd
3
+ metadata.gz: 6e1f8e0f98d31ffb815c33896596e96d54f8e898
4
+ data.tar.gz: 86e45f3707f47bf30177696bd6f9b9b5c9169388
5
5
  SHA512:
6
- metadata.gz: 978e45e9e78ffaa7966ef839857dc5a07be1bceef5519f121f86864b96c58d0e637c4320372c6f8c561338d95b3028c79bd645fee0df9422aadee878371a35dd
7
- data.tar.gz: 7206a57e4a8003f4ea565127d55353bf38c18567904aaa9802bf3f57f3b3e80e682a5efc83d115c78e4ed9cc177387ab5e39f7156b9c0ba9c3102b20f1a89cfb
6
+ metadata.gz: 30e1ad7393c47f161989fc4ba7f5970479bcb1d8b88e9b0d9af3d30288b0ab45a21b656f4c999d13ed6ce6203229c7a0238313e40e57bd28a2b14265e4409c9d
7
+ data.tar.gz: bcb837914daa5ae4b28b078227d283698ca64134de93fb94dc750a985949af533d70d817efc887328ad5d180bdd2ad837cb41ff1033e540f8995af4ef0144643
data/README.md CHANGED
@@ -21,7 +21,37 @@ Or install it yourself as:
21
21
 
22
22
  ## Usage
23
23
 
24
- TODO: Write usage instructions here
24
+ Create your instance variable, passing in the array you would like to sum all the combinations of.
25
+ ```ruby
26
+ sum_of_all = SumAllCombinations.new([1,2,3])
27
+ ```
28
+ Call the sum method and pass in the optional keyword arguments of remove_duplicates (default is false) and sort (default is true)
29
+ ```ruby
30
+ sum_of_all.sum(remove_duplicates: false, sort: true)
31
+ ```
32
+ The attributes available include:
33
+ ```ruby
34
+ # passed in array
35
+ @original
36
+
37
+ # flattened array. After sum is called flattened will only include the numbers used for calculation, non-numeric objects will be removed
38
+ @flattened
39
+
40
+ # calculated values array, which is the array holding all the numbers calculated from the addition of all of the possible number combinations, after sum is called
41
+ @calculated_values
42
+
43
+ #combinations used array, which is the array holding all the information of how the numbers were combined to determine results
44
+ @combinations_used
45
+ ```
46
+ ## Example
47
+ ```ruby
48
+ sum_of_all = SumAllCombinations.new([1,2,[3,4], "house"])
49
+ sum_of_all.original #=> [1, 2, [3, 4], "house"]
50
+ sum_of_all.flattened #=> [1, 2, 3, 4, "house"]
51
+ sum_of_all.sum #=> [3.0, 4.0, 5.0, 5.0, 6.0, 6.0, 7.0, 7.0, 8.0, 9.0, 10.0]
52
+ sum_of_all.calculated_values #=> [3.0, 4.0, 5.0, 5.0, 6.0, 6.0, 7.0, 7.0, 8.0, 9.0, 10.0]
53
+ sum_of_all.combinations_used #=> ["1.0+2.0+3.0+4.0=10.0", "1.0+2.0+3.0=6.0", "1.0+2.0+4.0=7.0", "1.0+2.0=3.0", "1.0+3.0+4.0=8.0", "1.0+3.0=4.0", "1.0+4.0=5.0", "2.0+3.0+4.0=9.0", "2.0+3.0=5.0", "2.0+4.0=6.0", "3.0+4.0=7.0"]
54
+ ```
25
55
 
26
56
  ## Development
27
57
 
@@ -1,3 +1,3 @@
1
1
  module SumAllNumberCombinations
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sum_all_number_combinations
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Trott
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-08-24 00:00:00.000000000 Z
11
+ date: 2016-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler