# File lib/vcard/vcard.rb, line 642
    def self.decode(card)
      if card.respond_to? :to_str
        string = card.to_str
      elsif card.respond_to? :read
        string = card.read(nil)
      else
        raise ArgumentError, "Vcard.decode cannot be called with a #{card.type}"
      end

      entities = ::Vcard.expand(::Vcard.decode(string))

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

      vcards = []

      for e in entities
        vcard  = new(e.flatten, "VCARD")
        vcards.push(vcard) if vcard.valid? || !::Vcard.configuration.ignore_invalid_vcards?
      end

      vcards
    end