lib/burgundy/collection.rb in burgundy-0.1.0 vs lib/burgundy/collection.rb in burgundy-0.2.0

- old
+ new

@@ -1,25 +1,22 @@ module Burgundy class Collection < SimpleDelegator include Enumerable - def initialize(items, wrapping_class = nil) + def initialize(items, wrapping_class = nil, *args) @items = items @wrapping_class = wrapping_class + @args = args __setobj__(@items) end - def empty? - !any? - end - def each(&block) to_ary.each(&block) end def to_ary @cache ||= if @wrapping_class - @items.map {|item| @wrapping_class.new(item) } + @items.map {|item| @wrapping_class.new(item, *@args) } else @items.to_a end end alias_method :to_a, :to_ary