Sha256: 3842f27bd7ed673a72fe3656d824299a26fc35e7f00d0ac5c10f5db84b029d17
Contents?: true
Size: 558 Bytes
Versions: 4
Compression:
Stored size: 558 Bytes
Contents
module SPNet # Keeps values to those found in the given Enumerable object. # # @author James Tunnell class EnumLimiter < Limiter attr_reader :values def initialize values raise ArgumentError, "values is not an Enumerable" unless values.is_a?(Enumerable) @values = values end # Limit the given value to those given by @values. If the given value is not # found, return the current value. def apply_limit value, current_value if @values.include? value return value else return current_value end end end end
Version data entries
4 entries across 4 versions & 1 rubygems