# File lib/vcard/vcard.rb, line 1333 def add_field(field) fieldname = field.name.upcase case when [ "BEGIN", "END" ].include?(fieldname) raise ::Vcard::InvalidEncodingError, "Not allowed to manually add #{field.name} to a vCard." when [ "VERSION", "N", "FN" ].include?(fieldname) if @card.field(fieldname) raise ::Vcard::InvalidEncodingError, "Not allowed to add more than one #{fieldname} to a vCard." end @card << field else @card << field end end