Sha256: f58d56e18a50a66ecfaef37fbad7aafad383a0aca74c3fa076a88bcbdf5db028
Contents?: true
Size: 356 Bytes
Versions: 3
Compression:
Stored size: 356 Bytes
Contents
module Bumpspark module Scale def scaled_numbers nums = numbers.empty? ? [0] : numbers min, max = nums.min, nums.max width = max - min return [1] * nums.size if width == 0 width = width * @scale nums.map do |result| ((result - min) * 100 / width.to_f).to_i end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
bumpspark-2.0.0 | lib/bumpspark/scale.rb |
bumpspark-1.1.1 | lib/bumpspark/scale.rb |
bumpspark-1.1.0 | lib/bumpspark/scale.rb |