Sha256: 9b87d5404e40564baf41efa9845c27084967809fb2920311a3f55dab8aa4cae4
Contents?: true
Size: 477 Bytes
Versions: 54
Compression:
Stored size: 477 Bytes
Contents
module Nanoc::Int # Stores item reps (in memory). # # @api private class ItemRepRepo include Enumerable def initialize @reps = [] @reps_by_item = {} end def <<(rep) @reps << rep @reps_by_item[rep.item] ||= [] @reps_by_item[rep.item] << rep end def to_a @reps end def each(&block) @reps.each(&block) self end def [](item) @reps_by_item.fetch(item, []) end end end
Version data entries
54 entries across 54 versions & 1 rubygems