Sha256: 2b9bf6213315e814cc61b7853bab0574fafa1e313b1b8b76d8f1d49ea88d677d
Contents?: true
Size: 473 Bytes
Versions: 1
Compression:
Stored size: 473 Bytes
Contents
module Vedeu class Limit def self.apply(v, vn, max, min = 1) new(v, vn, max, min).apply end def initialize(v, vn, max, min = 1) @v = v @vn = vn @max = max @min = min || 1 end def apply if (v + vn) > max applied = vn - ((v + vn) - max) return applied < min ? min : applied else vn end end private attr_reader :v, :vn, :min, :max end # Limit end # Vedeu
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
vedeu-0.3.4 | lib/vedeu/support/limit.rb |