Sha256: f7fd50b964a1e0e1e48252a201a7bc2b64e91fe5c3fc7c11bda53a0bba5ea246
Contents?: true
Size: 1.05 KB
Versions: 1
Compression:
Stored size: 1.05 KB
Contents
class Shoes class SlotContents < SimpleDelegator include Common::Inspect def initialize @contents = [] @prepending = false @prepending_index = 0 super(@contents) end def add_element(element) if @prepending prepend_element element else append_element element end end def prepend(&blk) @prepending_index = 0 @prepending = true blk.call @prepending = false end def clear # reverse_each is important as otherwise we always miss to delete one # element @contents.reverse_each do |element| element.is_a?(Shoes::Slot) ? element.clear : element.remove end @contents.clear end private def inspect_details " @size=#{size} @prepending=#{@prepending} @prepending_index=#{@prepending_index}" end def append_element(element) @contents << element end def prepend_element(element) @contents.insert @prepending_index, element @prepending_index += 1 end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
shoes-core-4.0.0.pre4 | lib/shoes/slot_contents.rb |