Sha256: c2c9569c5b1ed9992bab26155a7e23cf5a7ccf1228e88679b446a126bde2514b
Contents?: true
Size: 508 Bytes
Versions: 41
Compression:
Stored size: 508 Bytes
Contents
# frozen_string_literal: true 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
41 entries across 41 versions & 1 rubygems
Version | Path |
---|---|
nanoc-4.7.10 | lib/nanoc/base/repos/item_rep_repo.rb |