apportion 0.0.1 → 0.0.2
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/.gitignore +2 -0
- data/CHANGELOG.md +12 -0
- data/lib/apportion.rb +3 -5
- data/lib/apportion/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e0c14b2d76b4ec061abf3b78aa62a22f5d3ae42
|
4
|
+
data.tar.gz: 0e72028038c8b4c094e23e5581d256dfcc4ff216
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62d33343736ed7fc2574c25b0584e2124b3c54d8331537b5050c97025435b655c7d21def675f3bfdc32bfde288a8bf261fde92e58b0f6cfc8cd0a974ca64cea1
|
7
|
+
data.tar.gz: 773b48096dea707356a94992baa331bd0f1503b9686843cc10cf78f1aea52363adae1c42fd8bb1167a131c3e597f17e4241981fb412661d900a5686260943c16
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
## Changelog
|
2
|
+
|
3
|
+
### v0.0.2 (2016-02-01)
|
4
|
+
|
5
|
+
* bug fix
|
6
|
+
* prepend the module name to call methods in other modules (versus 'include')
|
7
|
+
|
8
|
+
### v0.0.1 (2016-01-29)
|
9
|
+
|
10
|
+
* initial
|
11
|
+
* support equal proportions algorithm
|
12
|
+
* support options for :prior_portions and :required_minimum
|
data/lib/apportion.rb
CHANGED
@@ -4,8 +4,6 @@ require 'apportion/util'
|
|
4
4
|
|
5
5
|
# Top level interface, or API, to distribute a quantity among recipients
|
6
6
|
module Apportion
|
7
|
-
include Apportion::Setup
|
8
|
-
include Apportion::Util
|
9
7
|
module_function
|
10
8
|
|
11
9
|
# Distributes a quantity among recipients by dividing proportionally according to relative
|
@@ -22,9 +20,9 @@ module Apportion
|
|
22
20
|
# # => {a: 3, b: 2, c: 2}
|
23
21
|
|
24
22
|
def division(weights, size, options = {})
|
25
|
-
portions = initial_portions(weights.keys, options)
|
26
|
-
sum_portions = hash_values_sum(portions)
|
27
|
-
validate(size, sum_portions)
|
23
|
+
portions = Setup.initial_portions(weights.keys, options)
|
24
|
+
sum_portions = Util.hash_values_sum(portions)
|
25
|
+
Setup.validate(size, sum_portions)
|
28
26
|
next_step(weights, portions, sum_portions, size)
|
29
27
|
end
|
30
28
|
|
data/lib/apportion/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apportion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gary Fleshman
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01
|
11
|
+
date: 2016-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -117,6 +117,7 @@ extra_rdoc_files: []
|
|
117
117
|
files:
|
118
118
|
- ".gitignore"
|
119
119
|
- ".travis.yml"
|
120
|
+
- CHANGELOG.md
|
120
121
|
- CODE_OF_CONDUCT.md
|
121
122
|
- Gemfile
|
122
123
|
- LICENSE.txt
|