Method: Vcard::DirectoryInfo#initialize

Defined in:
lib/vcard/dirinfo.rb

#initialize(fields, profile = nil) ⇒ DirectoryInfo

Initialize a DirectoryInfo object from fields. If profile is specified, check the BEGIN/END fields.



33
34
35
36
37
38
39
40
41
42
# File 'lib/vcard/dirinfo.rb', line 33

def initialize(fields, profile = nil) #:nodoc:
  if fields.detect { |f| ! f.kind_of? DirectoryInfo::Field }
    raise ArgumentError, "fields must be an array of DirectoryInfo::Field objects"
  end

  @string = nil # this is used as a flag to indicate that recoding will be necessary
  @fields = fields

  check_begin_end(profile) if profile
end