Sha256: f691a17348d6f76620a69ae2bebb4f0ef107e35c178dec5453e0a7ee18d2f7ee
Contents?: true
Size: 555 Bytes
Versions: 1
Compression:
Stored size: 555 Bytes
Contents
module Burgundy class Collection < SimpleDelegator include Enumerable def initialize(items, wrapping_class = nil, *args) @items = items @wrapping_class = wrapping_class @args = args __setobj__(@items) end def each(&block) to_ary.each(&block) end def to_ary @cache ||= if @wrapping_class @items.map {|item| @wrapping_class.new(item, *@args) } else @items.to_a end end alias_method :to_a, :to_ary end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
burgundy-0.2.0 | lib/burgundy/collection.rb |