# File lib/vpim/icalendar.rb, line 254
    def Icalendar.decode(cal, e = nil)
      entities = Vpim.expand(Vpim.decode(cal))

      # Since all iCalendars must have a begin/end, the top-level should
      # consist entirely of entities/arrays, even if its a single iCalendar.
      if entities.detect { |e| ! e.kind_of? Array }
        raise "Not a valid iCalendar"
      end

      calendars = []

      entities.each do |e|
        calendars << new(e)
      end

      calendars
    end