Module: RiCal
- Defined in:
- lib/ri_cal.rb,
lib/ri_cal/parser.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/property_value/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/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/properties/timezone_period.rb,
lib/ri_cal/property_value/cal_address.rb,
lib/ri_cal/invalid_timezone_identifier.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/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
-
©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, 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
- VERSION =
:stopdoc:
'0.8.5'
- LIBPATH =
::File.(::File.dirname(__FILE__)) + ::File::SEPARATOR
- PATH =
::File.dirname(LIBPATH) + ::File::SEPARATOR
Class Method Summary collapse
-
.Alarm(&init_block) ⇒ Object
return a new Alarm event or todo component.
-
.Calendar(&init_block) ⇒ Object
return a new Calendar.
-
.debug ⇒ Object
:nodoc:.
-
.debug=(val) ⇒ Object
:nodoc:.
-
.Event(&init_block) ⇒ Object
return a new Event calendar component.
-
.Freebusy(&init_block) ⇒ Object
return a new Freebusy calendar component.
-
.Journal(&init_block) ⇒ Object
return a new Journal calendar component.
-
.libpath(*args) ⇒ Object
Returns the library path for the module.
-
.parse(io) ⇒ Object
Parse an io stream and return an array of iCalendar entities.
-
.parse_string(string) ⇒ Object
Parse a string and return an array of iCalendar entities.
-
.path(*args) ⇒ Object
Returns the lpath for the module.
- .RationalOffset ⇒ Object
-
.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.
- .ro_calls ⇒ Object
- .ro_calls=(value) ⇒ Object
- .ro_misses ⇒ Object
- .ro_misses=(value) ⇒ Object
-
.Timezone(&init_block) ⇒ Object
return a new Timezone calendar component.
-
.TimezonePeriod(&init_block) ⇒ Object
return a new TimezonePeriod timezone component.
-
.Todo(&init_block) ⇒ Object
return a new Todo calendar component.
-
.version ⇒ Object
Returns the version string for the library.
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.
103 104 105 |
# File 'lib/ri_cal.rb', line 103 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.
110 111 112 |
# File 'lib/ri_cal.rb', line 110 def self.Calendar(&init_block) Component::Calendar.new(&init_block) end |
.debug ⇒ Object
:nodoc:
92 93 94 |
# File 'lib/ri_cal.rb', line 92 def self.debug # :nodoc: @debug end |
.debug=(val) ⇒ Object
:nodoc:
96 97 98 |
# File 'lib/ri_cal.rb', line 96 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.
117 118 119 |
# File 'lib/ri_cal.rb', line 117 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.
124 125 126 |
# File 'lib/ri_cal.rb', line 124 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.
131 132 133 |
# File 'lib/ri_cal.rb', line 131 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
.
54 55 56 |
# File 'lib/ri_cal.rb', line 54 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
82 83 84 |
# File 'lib/ri_cal.rb', line 82 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
88 89 90 |
# File 'lib/ri_cal.rb', line 88 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
.
62 63 64 |
# File 'lib/ri_cal.rb', line 62 def self.path( *args ) args.empty? ? PATH : ::File.join(PATH, args.flatten) end |
.RationalOffset ⇒ Object
172 173 174 175 176 177 |
# File 'lib/ri_cal.rb', line 172 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.
71 72 73 74 75 76 |
# File 'lib/ri_cal.rb', line 71 def self.require_all_libs_relative_to( fname, dir = nil ) dir ||= ::File.basename(fname, '.*') search_me = ::File.(::File.join(::File.dirname(fname), dir, '**', '*.rb')) Dir.glob(search_me).sort.each {|rb| require rb} end |
.ro_calls ⇒ Object
160 161 162 |
# File 'lib/ri_cal.rb', line 160 def self.ro_calls @ro_calls ||= 0 end |
.ro_calls=(value) ⇒ Object
156 157 158 |
# File 'lib/ri_cal.rb', line 156 def self.ro_calls=(value) @ro_calls = value end |
.ro_misses ⇒ Object
168 169 170 |
# File 'lib/ri_cal.rb', line 168 def self.ro_misses @ro_misses ||= 0 end |
.ro_misses=(value) ⇒ Object
164 165 166 |
# File 'lib/ri_cal.rb', line 164 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.
138 139 140 |
# File 'lib/ri_cal.rb', line 138 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.
145 146 147 |
# File 'lib/ri_cal.rb', line 145 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.
152 153 154 |
# File 'lib/ri_cal.rb', line 152 def self.Todo(&init_block) Component::Todo.new(&init_block) end |