Module: RiCal

Defined in:
lib/ri_cal.rb,
lib/ri_cal/parser.rb,
lib/ri_cal/component.rb,
lib/ri_cal/component/todo.rb,
lib/ri_cal/property_value.rb,
lib/ri_cal/component/alarm.rb,
lib/ri_cal/component/event.rb,
lib/ri_cal/properties/todo.rb,
lib/ri_cal/properties/alarm.rb,
lib/ri_cal/properties/event.rb,
lib/ri_cal/component/journal.rb,
lib/ri_cal/floating_timezone.rb,
lib/ri_cal/occurrence_period.rb,
lib/ri_cal/component/calendar.rb,
lib/ri_cal/component/freebusy.rb,
lib/ri_cal/component/timezone.rb,
lib/ri_cal/properties/journal.rb,
lib/ri_cal/property_value/geo.rb,
lib/ri_cal/property_value/uri.rb,
lib/ri_cal/required_timezones.rb,
lib/ri_cal/properties/calendar.rb,
lib/ri_cal/properties/freebusy.rb,
lib/ri_cal/properties/timezone.rb,
lib/ri_cal/property_value/date.rb,
lib/ri_cal/property_value/text.rb,
lib/ri_cal/property_value/array.rb,
lib/ri_cal/occurrence_enumerator.rb,
lib/ri_cal/property_value/period.rb,
lib/ri_cal/invalid_property_value.rb,
lib/ri_cal/property_value/integer.rb,
lib/ri_cal/property_value/duration.rb,
lib/ri_cal/property_value/date_time.rb,
lib/ri_cal/property_value/utc_offset.rb,
lib/ri_cal/invalid_timezone_identifer.rb,
lib/ri_cal/properties/timezone_period.rb,
lib/ri_cal/property_value/cal_address.rb,
lib/ri_cal/property_value/occurrence_list.rb,
lib/ri_cal/property_value/recurrence_rule.rb,
lib/ri_cal/core_extensions/date/conversions.rb,
lib/ri_cal/core_extensions/time/conversions.rb,
lib/ri_cal/core_extensions/time/tzid_access.rb,
lib/ri_cal/core_extensions/array/conversions.rb,
lib/ri_cal/core_extensions/time/calculations.rb,
lib/ri_cal/component/timezone/daylight_period.rb,
lib/ri_cal/component/timezone/standard_period.rb,
lib/ri_cal/component/timezone/timezone_period.rb,
lib/ri_cal/core_extensions/object/conversions.rb,
lib/ri_cal/core_extensions/string/conversions.rb,
lib/ri_cal/core_extensions/date_time/conversions.rb,
lib/ri_cal/property_value/date_time/time_machine.rb,
lib/ri_cal/core_extensions/time/week_day_predicates.rb,
lib/ri_cal/property_value/date_time/additive_methods.rb,
lib/ri_cal/property_value/date_time/timezone_support.rb,
lib/ri_cal/property_value/recurrence_rule/enumerator.rb,
lib/ri_cal/property_value/recurrence_rule/validations.rb,
lib/ri_cal/property_value/recurrence_rule/numbered_span.rb,
lib/ri_cal/property_value/recurrence_rule/recurring_day.rb,
lib/ri_cal/property_value/recurrence_rule/recurring_year_day.rb,
lib/ri_cal/property_value/recurrence_rule/recurring_month_day.rb,
lib/ri_cal/property_value/recurrence_rule/occurence_incrementer.rb,
lib/ri_cal/property_value/recurrence_rule/initialization_methods.rb,
lib/ri_cal/property_value/recurrence_rule/recurring_numbered_week.rb,
lib/ri_cal/property_value/recurrence_rule/negative_setpos_enumerator.rb,
lib/ri_cal/property_value/recurrence_rule/enumeration_support_methods.rb

Overview

  • ©2009 Rick DeNatale, All rights reserved. Refer to the file README.txt for the license

The RiCal module provides the outermost namespace, along with several convenience methods for parsing and building calendars and calendar components.

Defined Under Namespace

Modules: CoreExtensions, OccurrenceEnumerator, Properties, TimeWithZoneExtension Classes: Component, FloatingTimezone, InvalidPropertyValue, InvalidTimezoneIdentifier, OccurrencePeriod, Parser, PropertyValue, RequiredTimezones

Constant Summary collapse

VERSION =

:stopdoc:

'0.5.2'
LIBPATH =
::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
PATH =
::File.dirname(LIBPATH) + ::File::SEPARATOR
TimeWithZone =

TimeWithZone will be set to ActiveSupport::TimeWithZone if the activesupport gem is loaded otherwise it will be nil

time_with_zone

Class Method Summary collapse

Class Method Details

.Alarm(&init_block) ⇒ Object

return a new Alarm event or todo component. If a block is provided it will will be executed in the context of a builder object which can be used to initialize the properties of the new Alarm.



77
78
79
# File 'lib/ri_cal.rb', line 77

def self.Alarm(&init_block)
  Component::Alarm.new(&init_block)
end

.Calendar(&init_block) ⇒ Object

return a new Calendar. If a block is provided it will will be executed in the context of a builder object which can be used to initialize the properties and components of the new calendar.



84
85
86
# File 'lib/ri_cal.rb', line 84

def self.Calendar(&init_block)
  Component::Calendar.new(&init_block)
end

.debugObject

:nodoc:



66
67
68
# File 'lib/ri_cal.rb', line 66

def self.debug # :nodoc:
  @debug
end

.debug=(val) ⇒ Object

:nodoc:



70
71
72
# File 'lib/ri_cal.rb', line 70

def self.debug=(val) # :nodoc:
  @debug = val
end

.Event(&init_block) ⇒ Object

return a new Event calendar component. If a block is provided it will will be executed in the context of a builder object which can be used to initialize the properties and alarms of the new Event.



91
92
93
# File 'lib/ri_cal.rb', line 91

def self.Event(&init_block)
  Component::Event.new(&init_block)
end

.Freebusy(&init_block) ⇒ Object

return a new Freebusy calendar component. If a block is provided it will will be executed in the context of a builder object which can be used to initialize the properties and components of the new Freebusy.



98
99
100
# File 'lib/ri_cal.rb', line 98

def self.Freebusy(&init_block)
  Component::Freebusy.new(&init_block)
end

.Journal(&init_block) ⇒ Object

return a new Journal calendar component. If a block is provided it will will be executed in the context of a builder object which can be used to initialize the properties and components of the new Event.



105
106
107
# File 'lib/ri_cal.rb', line 105

def self.Journal(&init_block)
  Component::Journal.new(&init_block)
end

.libpath(*args) ⇒ Object

Returns the library path for the module. If any arguments are given, they will be joined to the end of the libray path using File.join.



28
29
30
# File 'lib/ri_cal.rb', line 28

def self.libpath( *args )
  args.empty? ? LIBPATH : ::File.join(LIBPATH, args.flatten)
end

.parse(io) ⇒ Object

Parse an io stream and return an array of iCalendar entities. Normally this will be an array of RiCal::Component::Calendar instances



56
57
58
# File 'lib/ri_cal.rb', line 56

def self.parse(io)
  Parser.new(io).parse
end

.parse_string(string) ⇒ Object

Parse a string and return an array of iCalendar entities. see RiCal.parse



62
63
64
# File 'lib/ri_cal.rb', line 62

def self.parse_string(string)
  parse(StringIO.new(string))
end

.path(*args) ⇒ Object

Returns the lpath for the module. If any arguments are given, they will be joined to the end of the path using File.join.



36
37
38
# File 'lib/ri_cal.rb', line 36

def self.path( *args )
  args.empty? ? PATH : ::File.join(PATH, args.flatten)
end

.require_all_libs_relative_to(fname, dir = nil) ⇒ Object

Utility method used to rquire all files ending in .rb that lie in the directory below this file that has the same name as the filename passed in. Optionally, a specific directory name can be passed in such that the filename does not have to be equivalent to the directory.



45
46
47
48
49
50
# File 'lib/ri_cal.rb', line 45

def self.require_all_libs_relative_to( fname, dir = nil )
  dir ||= ::File.basename(fname, '.*')
  search_me = ::File.expand_path(::File.join(::File.dirname(fname), dir, '**', '*.rb'))
  Dir.glob(search_me).sort.each {|rb|
    require rb}
end

.Timezone(&init_block) ⇒ Object

return a new Timezone calendar component. If a block is provided it will will be executed in the context of a builder object which can be used to initialize the properties and timezone periods of the new Timezone.



112
113
114
# File 'lib/ri_cal.rb', line 112

def self.Timezone(&init_block)
  Component::Timezone.new(&init_block)
end

.TimezonePeriod(&init_block) ⇒ Object

return a new TimezonePeriod timezone component. If a block is provided it will will be executed in the context of a builder object which can be used to initialize the properties of the new TimezonePeriod.



119
120
121
# File 'lib/ri_cal.rb', line 119

def self.TimezonePeriod(&init_block)
  Component::TimezonePeriod.new(&init_block)
end

.Todo(&init_block) ⇒ Object

return a new Todo calendar component. If a block is provided it will will be executed in the context of a builder object which can be used to initialize the properties and alarms of the new Todo.



137
138
139
# File 'lib/ri_cal.rb', line 137

def self.Todo(&init_block)
  Component::Todo.new(&init_block)
end

.versionObject

Returns the version string for the library.



20
21
22
# File 'lib/ri_cal.rb', line 20

def self.version
  VERSION
end