Module: RiCal

Defined in:
lib/ri_cal.rb,
lib/ri_cal/parser.rb,
lib/ri_cal/version.rb,
lib/ri_cal/component.rb,
lib/ri_cal/properties.rb,
lib/ri_cal/component/todo.rb,
lib/ri_cal/fast_date_time.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/core_extensions/date.rb,
lib/ri_cal/core_extensions/time.rb,
lib/ri_cal/property_value/array.rb,
lib/ri_cal/core_extensions/array.rb,
lib/ri_cal/occurrence_enumerator.rb,
lib/ri_cal/property_value/period.rb,
lib/ri_cal/component/non_standard.rb,
lib/ri_cal/core_extensions/object.rb,
lib/ri_cal/core_extensions/string.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/core_extensions/date_time.rb,
lib/ri_cal/property_value/utc_offset.rb,
lib/ri_cal/properties/timezone_period.rb,
lib/ri_cal/property_value/cal_address.rb,
lib/ri_cal/invalid_timezone_identifier.rb,
lib/ri_cal/property_value/zulu_date_time.rb,
lib/ri_cal/property_value/occurrence_list.rb,
lib/ri_cal/property_value/recurrence_rule.rb,
lib/ri_cal/core_extensions/time/tzid_access.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/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/time_manipulation.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/initialization_methods.rb,
lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer.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,
lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/list_incrementer.rb,
lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/daily_incrementer.rb,
lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_day_incrementer.rb,
lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/hourly_incrementer.rb,
lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/weekly_incrementer.rb,
lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/yearly_incrementer.rb,
lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_hour_incrementer.rb,
lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/monthly_incrementer.rb,
lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_month_incrementer.rb,
lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/minutely_incrementer.rb,
lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/secondly_incrementer.rb,
lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_minute_incrementer.rb,
lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_second_incrementer.rb,
lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_weekno_incrementer.rb,
lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/frequency_incrementer.rb,
lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_yearday_incrementer.rb,
lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_monthday_incrementer.rb,
lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/null_sub_cycle_incrementer.rb,
lib/ri_cal/property_value/recurrence_rule/occurrence_incrementer/by_numbered_day_incrementer.rb

Overview

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, FastDateTime, FloatingTimezone, InvalidPropertyValue, InvalidTimezoneIdentifier, OccurrencePeriod, Parser, PropertyValue, RequiredTimezones

Constant Summary collapse

TimeWithZone =

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

time_with_zone
LIBPATH =

:stopdoc:

::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
PATH =
::File.dirname(LIBPATH) + ::File::SEPARATOR
VERSION =
"0.9.0"

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.



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

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.



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

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

.debugObject

:nodoc:



89
90
91
# File 'lib/ri_cal.rb', line 89

def self.debug # :nodoc:
  @debug
end

.debug=(val) ⇒ Object

:nodoc:



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

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.



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

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.



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

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.



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

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.



51
52
53
# File 'lib/ri_cal.rb', line 51

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



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

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



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

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.



59
60
61
# File 'lib/ri_cal.rb', line 59

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

.RationalOffsetObject



169
170
171
172
173
174
# File 'lib/ri_cal.rb', line 169

def self.RationalOffset
  self.ro_calls += 1
  @rational_offset ||= Hash.new {|h, seconds|
    self.ro_misses += 1
    h[seconds] = Rational(seconds, 86400)}
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.



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

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

.ro_callsObject



157
158
159
# File 'lib/ri_cal.rb', line 157

def self.ro_calls
  @ro_calls ||= 0
end

.ro_calls=(value) ⇒ Object



153
154
155
# File 'lib/ri_cal.rb', line 153

def self.ro_calls=(value)
  @ro_calls = value
end

.ro_missesObject



165
166
167
# File 'lib/ri_cal.rb', line 165

def self.ro_misses
  @ro_misses ||= 0
end

.ro_misses=(value) ⇒ Object



161
162
163
# File 'lib/ri_cal.rb', line 161

def self.ro_misses=(value)
  @ro_misses = value
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.



135
136
137
# File 'lib/ri_cal.rb', line 135

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.



142
143
144
# File 'lib/ri_cal.rb', line 142

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.



149
150
151
# File 'lib/ri_cal.rb', line 149

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

.versionObject

Returns the version string for the library.



43
44
45
# File 'lib/ri_cal.rb', line 43

def self.version
  VERSION
end