module Fulfillment module Models class Collection include Enumerable extend Forwardable attr_reader :items, :_items delegate [:[], :each, :last, :size] => :items def initialize(item_type, items) @_items = items @items = Array.wrap(_items).map do |item| item_type.new(item) end end def [](value) items.force[value] end end end end