vpim 0.16 → 0.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/vpim/vpim.rb CHANGED
@@ -1,7 +1,5 @@
1
1
  =begin
2
- $Id: vpim.rb,v 1.20 2005/02/04 21:31:12 sam Exp $
3
-
4
- Copyright (C) 2005 Sam Roberts
2
+ Copyright (C) 2006 Sam Roberts
5
3
 
6
4
  This library is free software; you can redistribute it and/or modify it
7
5
  under the same terms as the ruby language itself, see the file COPYING for
@@ -14,31 +12,28 @@
14
12
  # Author:: Sam Roberts <sroberts@uniserve.com>
15
13
  # Copyright:: Copyright (C) 2006 Sam Roberts
16
14
  # License:: May be distributed under the same terms as Ruby
17
- # Version:: 0.16
15
+ # Version:: 0.17
18
16
  # Homepage:: http://vpim.rubyforge.org
19
17
  #
20
- # An implementation of the MIME Content-Type for Directory Information (RFC
21
- # 2425), and profiles of this format. The basic RFC 2425 format is implemented
22
- # by the DirectoryInfo class.
23
- #
24
- # Currently the only IETF-defined profile is vCard (RFC 2426), implemented by
25
- # the Vcard class.
26
- #
27
- # iCalendar (RFC 2445) was not specified as a profile of RFC 2425, could have
28
- # been, and is implemented by the Icalendar class.
18
+ # vCard (RFC 2426) is a format for personal information, see Vpim::Vcard and
19
+ # Vpim::Maker::Vcard.
29
20
  #
30
- # Both of these "v-formats" are for personal information management, thus the
31
- # name "vPim".
21
+ # iCalendar (RFC 2445) is a format for calendar related information, see
22
+ # Vpim::Icalendar.
32
23
  #
33
- # This is my first Ruby library, and I would love to have feedback on
34
- # useability. In particular, if anybody using this library could send me
35
- # any code showing how they call vPim, that would be very useful to me. It
36
- # doesn't have to be complete, I would just like to see how the APIs are
37
- # being called, to give me ideas for how to improve them.
24
+ # iCalendar was called vCalendar pre-IETF standaradization, and since both of
25
+ # these "v-formats" are commonly used personal information management, the
26
+ # library is called "vpim".
38
27
  #
39
- # Particularly, I'm interested in examples of encoding.
28
+ # vCard and iCalendar support is built on top of an implementation of the MIME
29
+ # Content-Type for Directory Information (RFC 2425). The basic RFC 2425 format
30
+ # is implemented by Vpim::DirectoryInfo and Vpim::DirectoryInfo::Field.
40
31
  #
41
- # Sam Roberts <sroberts@uniserve.com>
32
+ # The libary is mature to the point of useability, but there is always more
33
+ # that could be done. I have a very long todo list, so if you think something
34
+ # is missing, or have API suggestions, please contact me. I can't promise
35
+ # instantaneous turnaround, but I might be able to suggest another approach,
36
+ # and features requested by users of vPim are high priority for me.
42
37
  #
43
38
  # = Project Information
44
39
  #
@@ -46,8 +41,8 @@
46
41
  #
47
42
  # - http://rubyforge.org/projects/vpim
48
43
  #
49
- # If you are interested in notifications about new releases, or
50
- # asking questions about vPim, please subscribe to "vpim-talk":
44
+ # For notifications about new releases, or asking questions about vPim, please
45
+ # subscribe to "vpim-talk":
51
46
  #
52
47
  # - http://rubyforge.org/mailman/listinfo/vpim-talk
53
48
  #
@@ -56,16 +51,18 @@
56
51
  # Sample utilities are provided as examples of using vPim in samples/.
57
52
  #
58
53
  # vCard examples are:
59
- # - link:ex_mkvcard.txt: an example of making a vCard
54
+ # - link:ex_mkvcard.txt: example of creating a vCard
55
+ # - link:ex_cpvcard.txt: example of copying and them modifying a vCard
56
+ # - link:ex_mkv21vcard.txt: example of creating version 2.1 vCard
60
57
  # - link:mutt-aliases-to-vcf.txt: convert a mutt aliases file to vCards
61
58
  # - link:ex_get_vcard_photo.txt: pull photo data from a vCard
62
59
  # - link:ab-query.txt: query the OS X Address Book to find vCards
63
60
  # - link:vcf-to-mutt.txt: query vCards for matches, output in formats useful
64
61
  # with Mutt (see link:README.mutt for details)
65
- # - link:vcard-dump.txt: dump all the fields in a vCard
66
62
  # - link:tabbed-file-to-vcf.txt: convert a tab-delimited file to vCards, a
67
63
  # (small but) complete application contributed by Dane G. Avilla, thanks!
68
- # - link:vcf-to-ics.txt: example of how to create calendars of birthdays from vcards
64
+ # - link:vcf-to-ics.txt: example of how to create calendars of birthdays from vCards
65
+ # - link:vcf-dump.txt: utility for dumping contents of .vcf files
69
66
  #
70
67
  # iCalendar examples are:
71
68
  # - link:ics-to-rss.txt: prints todos as RSS, or starts a WEBrick servlet
@@ -78,9 +75,9 @@
78
75
  # - link:reminder.txt: prints upcoming events and todos, by default from
79
76
  # Apple's iCal calendars
80
77
  # - link:rrule.txt: utility for printing recurrence rules
81
- # - link:ical-dump.txt: utility for dumping contents of .ics files
78
+ # - link:ics-dump.txt: utility for dumping contents of .ics files
82
79
  module Vpim
83
- VERSION = "0.16"
80
+ VERSION = "0.17"
84
81
 
85
82
  # Return the API version as a string.
86
83
  def Vpim.version
@@ -94,3 +91,38 @@ module Vpim
94
91
  class InvalidEncodingError < StandardError; end
95
92
  end
96
93
 
94
+ module Vpim::Methods
95
+ module_function
96
+
97
+ # Case-insensitive comparison of +str0+ to +str1+, returns true or false.
98
+ # Either argument can be nil, where nil compares not equal to anything other
99
+ # than nil.
100
+ #
101
+ # This is available both as a module function:
102
+ # Vpim::Methods.casecmp?("yes", "YES")
103
+ # and an instance method:
104
+ # include Vpim::Methods
105
+ # casecmp?("yes", "YES")
106
+ #
107
+ # Will work with ruby1.6 and ruby 1.8.
108
+ #
109
+ # TODO - could make this be more efficient, but I'm supporting 1.6, not
110
+ # optimizing for it.
111
+ def casecmp?(str0, str1)
112
+ if str0 == nil
113
+ if str1 == nil
114
+ return true
115
+ else
116
+ return fasle
117
+ end
118
+ end
119
+
120
+ begin
121
+ str0.casecmp(str1) == 0
122
+ rescue NoMethodError
123
+ str0.downcase == str1.downcase
124
+ end
125
+ end
126
+
127
+ end
128
+
data/lib/vpim/vpim.rb~ CHANGED
@@ -1,7 +1,5 @@
1
1
  =begin
2
- $Id: vpim.rb,v 1.20 2005/02/04 21:31:12 sam Exp $
3
-
4
- Copyright (C) 2005 Sam Roberts
2
+ Copyright (C) 2006 Sam Roberts
5
3
 
6
4
  This library is free software; you can redistribute it and/or modify it
7
5
  under the same terms as the ruby language itself, see the file COPYING for
@@ -14,31 +12,28 @@
14
12
  # Author:: Sam Roberts <sroberts@uniserve.com>
15
13
  # Copyright:: Copyright (C) 2006 Sam Roberts
16
14
  # License:: May be distributed under the same terms as Ruby
17
- # Version:: 0.16
15
+ # Version:: 0.17
18
16
  # Homepage:: http://vpim.rubyforge.org
19
17
  #
20
- # An implementation of the MIME Content-Type for Directory Information (RFC
21
- # 2425), and profiles of this format. The basic RFC 2425 format is implemented
22
- # by the DirectoryInfo class.
23
- #
24
- # Currently the only IETF-defined profile is vCard (RFC 2426), implemented by
25
- # the Vcard class.
26
- #
27
- # iCalendar (RFC 2445) was not specified as a profile of RFC 2425, could have
28
- # been, and is implemented by the Icalendar class.
18
+ # vCard (RFC 2426) is a format for personal information, see Vpim::Vcard and
19
+ # Vpim::Maker::Vcard.
29
20
  #
30
- # Both of these "v-formats" are for personal information management, thus the
31
- # name "vPim".
21
+ # iCalendar (RFC 2445) is a format for calendar related information, see
22
+ # Vpim::Icalendar.
32
23
  #
33
- # This is my first Ruby library, and I would love to have feedback on
34
- # useability. In particular, if anybody using this library could send me
35
- # any code showing how they call vPim, that would be very useful to me. It
36
- # doesn't have to be complete, I would just like to see how the APIs are
37
- # being called, to give me ideas for how to improve them.
24
+ # iCalendar was called vCalendar pre-IETF standaradization, and since both of
25
+ # these "v-formats" are commonly used personal information management, the
26
+ # library is called "vpim".
38
27
  #
39
- # Particularly, I'm interested in examples of encoding.
28
+ # vCard and iCalendar support is built on top of an implementation of the MIME
29
+ # Content-Type for Directory Information (RFC 2425). The basic RFC 2425 format
30
+ # is implemented by Vpim::DirectoryInfo and Vpim::DirectoryInfo::Field.
40
31
  #
41
- # Sam Roberts <sroberts@uniserve.com>
32
+ # The libary is mature to the point of useability, but there is always more
33
+ # that could be done. I have a very long todo list, so if you think something
34
+ # is missing, or have API suggestions, please contact me. I can't promise
35
+ # instantaneous turnaround, but I might be able to suggest another approach,
36
+ # and features requested by users of vPim are high priority for me.
42
37
  #
43
38
  # = Project Information
44
39
  #
@@ -46,8 +41,8 @@
46
41
  #
47
42
  # - http://rubyforge.org/projects/vpim
48
43
  #
49
- # If you are interested in notifications about new releases, or
50
- # asking questions about vPim, please subscribe to "vpim-talk":
44
+ # For notifications about new releases, or asking questions about vPim, please
45
+ # subscribe to "vpim-talk":
51
46
  #
52
47
  # - http://rubyforge.org/mailman/listinfo/vpim-talk
53
48
  #
@@ -56,16 +51,18 @@
56
51
  # Sample utilities are provided as examples of using vPim in samples/.
57
52
  #
58
53
  # vCard examples are:
59
- # - link:ex_mkvcard.txt: an example of making a vCard
54
+ # - link:ex_mkvcard.txt: example of creating a vCard
55
+ # - link:ex_cpvcard.txt: example of copying and them modifying a vCard
56
+ # - link:ex_mkv21vcard.txt: example of creating version 2.1 vCard
60
57
  # - link:mutt-aliases-to-vcf.txt: convert a mutt aliases file to vCards
61
58
  # - link:ex_get_vcard_photo.txt: pull photo data from a vCard
62
59
  # - link:ab-query.txt: query the OS X Address Book to find vCards
63
60
  # - link:vcf-to-mutt.txt: query vCards for matches, output in formats useful
64
61
  # with Mutt (see link:README.mutt for details)
65
- # - link:vcard-dump.txt: dump all the fields in a vCard
66
62
  # - link:tabbed-file-to-vcf.txt: convert a tab-delimited file to vCards, a
67
63
  # (small but) complete application contributed by Dane G. Avilla, thanks!
68
- # - link:vcf-to-ics.txt: example of how to create calendars of birthdays from vcards
64
+ # - link:vcf-to-ics.txt: example of how to create calendars of birthdays from vCards
65
+ # - link:vcf-dump.txt: utility for dumping contents of .vcf files
69
66
  #
70
67
  # iCalendar examples are:
71
68
  # - link:ics-to-rss.txt: prints todos as RSS, or starts a WEBrick servlet
@@ -78,9 +75,9 @@
78
75
  # - link:reminder.txt: prints upcoming events and todos, by default from
79
76
  # Apple's iCal calendars
80
77
  # - link:rrule.txt: utility for printing recurrence rules
81
- # - link:ical-dump.txt: utility for dumping contents of .ics files
78
+ # - link:ics-dump.txt: utility for dumping contents of .ics files
82
79
  module Vpim
83
- VERSION = "0.16"
80
+ VERSION = "0.17"
84
81
 
85
82
  # Return the API version as a string.
86
83
  def Vpim.version
@@ -94,3 +91,38 @@ module Vpim
94
91
  class InvalidEncodingError < StandardError; end
95
92
  end
96
93
 
94
+ module Vpim::Methods
95
+ module_function
96
+
97
+ # Case-insensitive comparison of +str0+ to +str1+, returns true or false.
98
+ # Either argument can be nil, where nil compares not equal to anything other
99
+ # than nil.
100
+ #
101
+ # This is available both as a module function:
102
+ # Vpim::Methods.casecmp?("yes", "YES")
103
+ # and an instance method:
104
+ # include Vpim::Methods
105
+ # casecmp?("yes", "YES")
106
+ #
107
+ # Will work with ruby1.6 and ruby 1.8.
108
+ #
109
+ # TODO - could make this be more efficient, but I'm supporting 1.6, not
110
+ # optimizing for it.
111
+ def casecmp?(str0, str1)
112
+ if str0 == nil
113
+ if str1 == nil
114
+ return true
115
+ else
116
+ return fasle
117
+ end
118
+ end
119
+
120
+ begin
121
+ str0.casecmp(str1) == 0
122
+ rescue NoMethodError
123
+ str0.downcase == str1.downcase
124
+ end
125
+ end
126
+
127
+ end
128
+
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
3
3
  specification_version: 1
4
4
  name: vpim
5
5
  version: !ruby/object:Gem::Version
6
- version: "0.16"
7
- date: 2006-02-19 00:00:00 -08:00
6
+ version: "0.17"
7
+ date: 2006-03-08 00:00:00 -08:00
8
8
  summary: a library to manipulate vCards and iCalendars
9
9
  require_paths:
10
10
  - lib
@@ -29,21 +29,35 @@ authors:
29
29
  - Sam Roberts
30
30
  files:
31
31
  - lib/vpim
32
+ - lib/vpim/agent
32
33
  - lib/vpim/date.rb
34
+ - lib/vpim/date.rb~
33
35
  - lib/vpim/dirinfo.rb
36
+ - lib/vpim/dirinfo.rb~
34
37
  - lib/vpim/duration.rb
38
+ - lib/vpim/duration.rb~
35
39
  - lib/vpim/enumerator.rb
40
+ - lib/vpim/enumerator.rb~
36
41
  - lib/vpim/field.rb
42
+ - lib/vpim/field.rb~
37
43
  - lib/vpim/icalendar.rb
44
+ - lib/vpim/icalendar.rb~
38
45
  - lib/vpim/maker
39
46
  - lib/vpim/rfc2425.rb
47
+ - lib/vpim/rfc2425.rb~
40
48
  - lib/vpim/rrule.rb
49
+ - lib/vpim/rrule.rb~
41
50
  - lib/vpim/time.rb
51
+ - lib/vpim/time.rb~
42
52
  - lib/vpim/vcard.rb
53
+ - lib/vpim/vcard.rb~
43
54
  - lib/vpim/vevent.rb
55
+ - lib/vpim/vevent.rb~
44
56
  - lib/vpim/vpim.rb
45
57
  - lib/vpim/vpim.rb~
58
+ - lib/vpim/agent/plist.rb
46
59
  - lib/vpim/maker/vcard.rb
60
+ - lib/vpim/maker/vcard.rb~
47
61
  test_files: []
48
62
 
49
63
  rdoc_options: []