class SPNet::LowerLimiter
Keeps values at or above the given Limit
.
@author James Tunnell
Attributes
inclusive[R]
limit[R]
Public Class Methods
new(limit, inclusive)
click to toggle source
# File lib/spnet/limiters/lower_limiter.rb, line 8 def initialize limit, inclusive @limit = limit @inclusive = inclusive end
Public Instance Methods
apply_limit(value, current_value = nil)
click to toggle source
Limit
the given value to be at or above @limit. Ignores the current_value parameter.
# File lib/spnet/limiters/lower_limiter.rb, line 14 def apply_limit value, current_value = nil if inclusive if value >= @limit return value else return @limit end else if value > @limit return value else return @limit + Float::EPSILON end end end