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/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/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/time_with_floating_timezone.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/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 Classes: Component, FloatingTimezone, InvalidTimezoneIdentifier, Parser, PropertyValue, RequiredTimezones, TimeWithFloatingTimezone

Constant Summary collapse

VERSION =

:stopdoc:

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

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.



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

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.



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

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

.debugObject

:nodoc:



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

def self.debug # :nodoc:
  @debug
end

.debug=(val) ⇒ Object

:nodoc:



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

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.



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

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.



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

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.



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

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.



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

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



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

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



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

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.



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

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.



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

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.



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

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.



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

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.



127
128
129
# File 'lib/ri_cal.rb', line 127

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

.versionObject

Returns the version string for the library.



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

def self.version
  VERSION
end