lib/vpim/dirinfo.rb in vpim-0.695 vs lib/vpim/dirinfo.rb in vpim-13.11.11

- old
+ new

@@ -1,5 +1,6 @@ +# -*- encoding : utf-8 -*- =begin Copyright (C) 2008 Sam Roberts This library is free software; you can redistribute it and/or modify it under the same terms as the ruby language itself, see the file COPYING for @@ -92,11 +93,11 @@ f = [ Field.create('BEGIN', p) ] f.concat fields f.push Field.create('END', p) fields = f end - + new(fields, profile) end # The first field named +name+, or nil if no # match is found. @@ -155,11 +156,11 @@ # collection, mapping, etc. # # Examples: # # Print all the nicknames in a card: - # + # # card.enum_by_name('NICKNAME') { |f| puts f.value } # # Print an Array of the preferred email addresses in the card: # # pref_emails = card.enum_by_name('EMAIL').select { |f| f.pref? } @@ -176,11 +177,11 @@ # puts "#{group} -> #{field.name}" # end # end # # or to get an array of all the fields in group 'AGROUP', you could do: - # + # # card.enum_by_group('AGROUP').to_a def enum_by_group(group) Enumerator.new(self, Proc.new { |field| field.group?(group) }) end @@ -248,10 +249,10 @@ end alias to_s encode # Check that the DirectoryInfo object is correctly delimited by a BEGIN - # and END, that their profile values match, and if +profile+ is specified, that + # and END, that their profile values match, and if +profile+ is specified, that # they are the specified profile. def check_begin_end(profile=nil) #:nodoc: unless @fields.first raise "No fields to check" end