Add documentation for Rubella:Weighting::PerValue
This commit is contained in:
parent
3bfb03c29c
commit
7c7c554d83
|
@ -1,17 +1,37 @@
|
||||||
module Rubella
|
module Rubella
|
||||||
module Weighting
|
module Weighting
|
||||||
|
|
||||||
# Gets an input object and prepares the data for the output.
|
# The Rubella::Weighting object processes the given input data to an valid
|
||||||
|
# output processable Array.
|
||||||
|
# These arrays contain a subarray for every unit of time. And these Array
|
||||||
|
# contain the buckets within the values for the output objects.
|
||||||
|
# The Weighting of the print intensitiy is done here, so that the output
|
||||||
|
# objects job is simply to print the stuff.
|
||||||
|
#
|
||||||
|
# The Rubella::Weighting::PerValue object weights every bucket set to 1 in
|
||||||
|
# ammount. So if you have have for example four cores, every core is
|
||||||
|
# weighted to 0.25 no matter how much the load of a single core is. It's
|
||||||
|
# just a "as is" weighting.
|
||||||
class PerValue
|
class PerValue
|
||||||
attr_reader :buckets
|
attr_reader :buckets
|
||||||
# : steps
|
# :steps
|
||||||
|
|
||||||
|
# Constructor
|
||||||
# buckets must be one of 1, 2, 5, 10, 20, 50 default is 10
|
# Creates a new Rubella::Weighting::PerValue object.
|
||||||
|
#
|
||||||
|
# @param buckets int must be one of 1, 2, 5, 10, 20, 50 default is 10
|
||||||
|
# @return Rubella::Weighting::PerValue
|
||||||
|
# @raise ArgumentError
|
||||||
def initialize(buckets = 10)
|
def initialize(buckets = 10)
|
||||||
self.buckets = buckets
|
self.buckets = buckets
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Creates a output readable list.
|
||||||
|
# This list is Array within a subarrays, which contain the buckets for
|
||||||
|
# every time value unit.
|
||||||
|
#
|
||||||
|
# @param input Rubella::Input An input object
|
||||||
|
# @return Array
|
||||||
def parse input
|
def parse input
|
||||||
data = input.data
|
data = input.data
|
||||||
# no data, no work
|
# no data, no work
|
||||||
|
@ -37,6 +57,10 @@ module Rubella
|
||||||
data_list
|
data_list
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Sets the buckets, if the value is valid
|
||||||
|
#
|
||||||
|
# @param buckets int The amount of buckets
|
||||||
|
# @raise ArgumentError
|
||||||
def buckets= buckets
|
def buckets= buckets
|
||||||
# Must be divideable by 100
|
# Must be divideable by 100
|
||||||
if([1, 2, 5, 10, 20, 50].index(buckets) == nil)
|
if([1, 2, 5, 10, 20, 50].index(buckets) == nil)
|
||||||
|
|
Loading…
Reference in New Issue