vpim 0.17 → 0.323

Sign up to get free protection for your applications and to get access to all the features.
data/lib/vpim/vpim.rb~ DELETED
@@ -1,128 +0,0 @@
1
- =begin
2
- Copyright (C) 2006 Sam Roberts
3
-
4
- This library is free software; you can redistribute it and/or modify it
5
- under the same terms as the ruby language itself, see the file COPYING for
6
- details.
7
- =end
8
-
9
- #:main:Vpim
10
- #:title:vpim - a library to manipulate vCards and iCalendars
11
- #
12
- # Author:: Sam Roberts <sroberts@uniserve.com>
13
- # Copyright:: Copyright (C) 2006 Sam Roberts
14
- # License:: May be distributed under the same terms as Ruby
15
- # Version:: 0.17
16
- # Homepage:: http://vpim.rubyforge.org
17
- #
18
- # vCard (RFC 2426) is a format for personal information, see Vpim::Vcard and
19
- # Vpim::Maker::Vcard.
20
- #
21
- # iCalendar (RFC 2445) is a format for calendar related information, see
22
- # Vpim::Icalendar.
23
- #
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".
27
- #
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.
31
- #
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.
37
- #
38
- # = Project Information
39
- #
40
- # The latest release can be downloaded from the Ruby Forge project page:
41
- #
42
- # - http://rubyforge.org/projects/vpim
43
- #
44
- # For notifications about new releases, or asking questions about vPim, please
45
- # subscribe to "vpim-talk":
46
- #
47
- # - http://rubyforge.org/mailman/listinfo/vpim-talk
48
- #
49
- # = Examples
50
- #
51
- # Sample utilities are provided as examples of using vPim in samples/.
52
- #
53
- # vCard examples are:
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
57
- # - link:mutt-aliases-to-vcf.txt: convert a mutt aliases file to vCards
58
- # - link:ex_get_vcard_photo.txt: pull photo data from a vCard
59
- # - link:ab-query.txt: query the OS X Address Book to find vCards
60
- # - link:vcf-to-mutt.txt: query vCards for matches, output in formats useful
61
- # with Mutt (see link:README.mutt for details)
62
- # - link:tabbed-file-to-vcf.txt: convert a tab-delimited file to vCards, a
63
- # (small but) complete application contributed by Dane G. Avilla, thanks!
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
66
- #
67
- # iCalendar examples are:
68
- # - link:ics-to-rss.txt: prints todos as RSS, or starts a WEBrick servlet
69
- # that publishes todos as a RSS feed. Thanks to Dave Thomas for this idea,
70
- # from http://pragprog.com/pragdave/Tech/Blog/ToDos.rdoc.
71
- # - link:cmd-itip.txt: prints emailed iCalendar invitations in human-readable
72
- # form, and see link:README.mutt for instruction on mutt integration. I get
73
- # a lot of meeting invitations from Lotus Notes/Domino users at work, and
74
- # this is pretty useful in figuring out where and when I am supposed to be.
75
- # - link:reminder.txt: prints upcoming events and todos, by default from
76
- # Apple's iCal calendars
77
- # - link:rrule.txt: utility for printing recurrence rules
78
- # - link:ics-dump.txt: utility for dumping contents of .ics files
79
- module Vpim
80
- VERSION = "0.17"
81
-
82
- # Return the API version as a string.
83
- def Vpim.version
84
- VERSION
85
- end
86
- end
87
-
88
- module Vpim
89
- # Exception used to indicate that data being decoded is invalid, the message
90
- # usually gives some clue as to exactly what is invalid.
91
- class InvalidEncodingError < StandardError; end
92
- end
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
-