Sha256: f50b8a336eecc9a75a5fcf19f58ea8b9cff7e0a62dd65b3f17cbfae087d4309d
Contents?: true
Size: 754 Bytes
Versions: 8
Compression:
Stored size: 754 Bytes
Contents
require 'prop/key' module Prop class Options # Sanitizes the option set and sets defaults def self.build(options) key = options.fetch(:key) params = options.fetch(:params) defaults = options.fetch(:defaults) result = defaults.merge(params) result[:key] = Prop::Key.normalize(key) result[:strategy] = if leaky_bucket.include?(result[:strategy]) Prop::LeakyBucketStrategy elsif result[:strategy] == nil Prop::IntervalStrategy else result[:strategy] # allowing any new/unknown strategy to be used end result[:strategy].validate_options!(result) result end def self.leaky_bucket [:leaky_bucket, "leaky_bucket"] end end end
Version data entries
8 entries across 8 versions & 1 rubygems