Sha256: a78f399d13e4564c7ab17b686306db044f4b8b974635c8b3156659ef2ea7fb66
Contents?: true
Size: 895 Bytes
Versions: 3
Compression:
Stored size: 895 Bytes
Contents
module SPCore class Limiters def self.make_no_limiter return lambda do |input| return input end end def self.make_range_limiter range return lambda do |input| if input < range.first return range.first elsif input > range.last return range.last else return input end end end def self.make_upper_limiter limit return lambda do |input| if input > limit return limit else return input end end end def self.make_lower_limiter limit return lambda do |input| if input < limit return limit else return input end end end def self.make_enum_limiter good_values return lambda do |input, current| if good_values.include?(input) return input else return current end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
spcore-0.1.2 | lib/spcore/core/limiters.rb |
spcore-0.1.1 | lib/spcore/core/limiters.rb |
spcore-0.1.0 | lib/spcore/core/limiters.rb |