Sha256: 9390d117c6b67ba25ce88f1d39fcb24944b1364f6418114a275b8eef801552f2
Contents?: true
Size: 559 Bytes
Versions: 1
Compression:
Stored size: 559 Bytes
Contents
module Steep module Services class PathAssignment attr_reader :index, :max_index, :cache def initialize(index:, max_index:) @index = index @max_index = max_index @cache = {} end def self.all new(index: 0, max_index: 1) end def =~(path) path = path.to_s if cache.key?(path) cache[path] else value = Digest::MD5.hexdigest(path).hex % max_index == index cache[path] = value value end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
steep-0.42.0 | lib/steep/services/path_assignment.rb |