Sha256: 1b15b496c10fc88fc42b85eadc281b6b949ed39a732970983ef50c105bb3dc5d
Contents?: true
Size: 1.14 KB
Versions: 5
Compression:
Stored size: 1.14 KB
Contents
module Nanoc::Int # @api private class OutdatednessStore < ::Nanoc::Int::Store include Nanoc::Int::ContractsSupport contract C::KeywordArgs[site: C::Maybe[Nanoc::Int::Site], reps: Nanoc::Int::ItemRepRepo] => C::Any def initialize(site: nil, reps:) super(Nanoc::Int::Store.tmp_path_for(env_name: (site.config.env_name if site), store_name: 'outdatedness'), 1) @outdated_reps = Set.new @all_reps = reps end contract Nanoc::Int::ItemRep => C::Bool def include?(obj) @outdated_reps.include?(obj) end contract Nanoc::Int::ItemRep => self def add(obj) @outdated_reps << obj self end contract Nanoc::Int::ItemRep => self def remove(obj) @outdated_reps.delete(obj) self end contract C::None => C::ArrayOf[Nanoc::Int::ItemRep] def to_a @outdated_reps.to_a end protected def data @outdated_reps.map(&:reference) end def data=(new_data) outdated_refs = Set.new(new_data) all_reps = Set.new(@all_reps) @outdated_reps = Set.new(all_reps.select { |rep| outdated_refs.include?(rep.reference) }) end end end
Version data entries
5 entries across 5 versions & 1 rubygems