module Phlex::Collection
def initialize(collection: nil, item: nil)
def initialize(collection: nil, item: nil) unless collection || item raise ArgumentError, "You must pass a collection or an item as a keyword argument." end @collection = collection @item = item end
def template
def template @item ? item_template : collection_template { yield_items } end
def yield_items
def yield_items m ArgumentError, "You can only yield_items when rendering a collection. You are currently rendering an item." tion.each do |item| = item emplate nil