Sha256: 975ff8b1d185f2a1c2b48fd3d11c5deabac08f685bbc1700cea7a96b3281390d
Contents?: true
Size: 588 Bytes
Versions: 7
Compression:
Stored size: 588 Bytes
Contents
module Sitemap class Store attr_accessor :entries, :max_entries, :reset_count, :before_reset_callback def initialize(options = {}) self.entries = [] self.reset_count = 0 self.max_entries = options[:max_entries] end def << entry reset! if entries.length >= max_entries self.entries << entry end def reset! before_reset_callback.call(entries) if before_reset_callback self.entries = [] self.reset_count += 1 end def before_reset(&block) self.before_reset_callback = block end end end
Version data entries
7 entries across 7 versions & 1 rubygems