Permalink
Browse files

version 0.5.0 rubyforge release candidate

  • Loading branch information...
1 parent 481e97e commit 5d9f1cafcc79fca9b0ddf91af0f8a26ab2ad0b28 @rubyredrick committed May 26, 2009
View
@@ -11,7 +11,7 @@ module RiCal
autoload :OccurrenceEnumerator, "#{my_dir}/ri_cal/occurrence_enumerator.rb"
# :stopdoc:
- VERSION = '0.0.11'
+ VERSION = '0.5.0'
LIBPATH = ::File.expand_path(::File.dirname(__FILE__)) + ::File::SEPARATOR
PATH = ::File.dirname(LIBPATH) + ::File::SEPARATOR
@@ -29,24 +29,32 @@ def start_time
dtstart_property ? dtstart.to_datetime : nil
end
- def zulu_occurrence_range_start
- if dtstart_property
- start_time
- else
- nil
- end
- end
-
# Return a date_time representing the time at which the event starts
- def finish_time
+ def finish_property
if dtend_property
- dtend_property.to_finish_time
+ dtend_property
elsif duration_property
- (dtstart_property + duration_property).to_finish_time
+ (dtstart_property + duration_property)
else
- dtstart_property.to_finish_time
+ dtstart_property
end
end
+
+ # Return a date_time representing the time at which the event starts
+ def finish_time
+ prop = finish_property
+ prop ? prop.to_finish_time : nil
+ end
+
+ def zulu_occurrence_range_start_time
+ dtstart_property ? dtstart_property.to_zulu_occurrence_range_start_time : nil
+ end
+
+ def zulu_occurrence_range_finish_time
+ prop = finish_property
+ prop ? prop.to_zulu_occurrence_range_finish_time : nil
+ end
+
end
end
end
@@ -24,14 +24,14 @@ def subcomponent_class #:nodoc:
# Return a date_time representing the time at which the todo should start
def start_time
- dtstart.to_datetime
+ dtstart_property ? dtstart.to_datetime : nil
end
# Return a date_time representing the time at which the todo is due
def finish_time
if due
due_property.to_finish_time
- elsif duration_property
+ elsif duration_property && dtstart_property
(dtstart_property + duration_property).to_finish_time
else
nil
@@ -180,9 +180,7 @@ def zulu_occurrence_range
first = occurrences(:count => 1).first
last = nil
end
- first_start = all.first.dtstart.utc.ruby_object
- last_end = all.last.dtend.utc.ruby_object
- [first.zulu_occurrence_range_start, last ? last.zulu_occurrence_range_end : nil]
+ [first.zulu_occurrence_range_start_time, last ? last.zulu_occurrence_range_finish_time : nil]
end
def set_occurrence_properties!(occurrence) # :nodoc:
@@ -54,7 +54,7 @@ def created_property
# set the CREATED property
# property value should be an instance of RiCal::PropertyValueDateTime
def created_property=(property_value)
- @created_property = property_value.for_parent(self)
+ @created_property = property_value ? property_value.for_parent(self) : nil
end
# set the value of the CREATED property
@@ -120,7 +120,7 @@ def dtstart_property
# set the DTSTART property
# property value should be an instance of either RiCal::PropertyValue::DateTime or RiCal::PropertyValue::Date
def dtstart_property=(property_value)
- @dtstart_property = property_value.for_parent(self)
+ @dtstart_property = property_value ? property_value.for_parent(self) : nil
end
# set the value of the DTSTART property
@@ -186,7 +186,7 @@ def last_modified_property
# set the LAST-MODIFIED property
# property value should be an instance of RiCal::PropertyValueDateTime
def last_modified_property=(property_value)
- @last_modified_property = property_value.for_parent(self)
+ @last_modified_property = property_value ? property_value.for_parent(self) : nil
end
# set the value of the LAST-MODIFIED property
@@ -318,7 +318,7 @@ def dtstamp_property
# set the DTSTAMP property
# property value should be an instance of RiCal::PropertyValueDateTime
def dtstamp_property=(property_value)
- @dtstamp_property = property_value.for_parent(self)
+ @dtstamp_property = property_value ? property_value.for_parent(self) : nil
end
# set the value of the DTSTAMP property
@@ -549,7 +549,7 @@ def recurrence_id_property
# set the RECURRENCE-ID property
# property value should be an instance of either RiCal::PropertyValue::DateTime or RiCal::PropertyValue::Date
def recurrence_id_property=(property_value)
- @recurrence_id_property = property_value.for_parent(self)
+ @recurrence_id_property = property_value ? property_value.for_parent(self) : nil
end
# set the value of the RECURRENCE-ID property
@@ -582,7 +582,7 @@ def dtend_property
# set the DTEND property
# property value should be an instance of either RiCal::PropertyValue::DateTime or RiCal::PropertyValue::Date
def dtend_property=(property_value)
- @dtend_property = property_value.for_parent(self)
+ @dtend_property = property_value ? property_value.for_parent(self) : nil
@duration_property = nil
end
@@ -1039,8 +1039,8 @@ def rdates=(ruby_values)
# set the value of the RDATE property to a single value
# one instance of OccurrenceList may be passed to this method
- def rdate=(ruby_value)
- @rdate_property = [RiCal::PropertyValue::OccurrenceList.convert(self, ruby_value)]
+ def rdate=(*ruby_value)
+ @rdate_property = [RiCal::PropertyValue::OccurrenceList.convert(self, *ruby_value)]
end
# add one or more values to the RDATE property
@@ -54,7 +54,7 @@ def dtstart_property
# set the DTSTART property
# property value should be an instance of either RiCal::PropertyValue::DateTime or RiCal::PropertyValue::Date
def dtstart_property=(property_value)
- @dtstart_property = property_value.for_parent(self)
+ @dtstart_property = property_value ? property_value.for_parent(self) : nil
end
# set the value of the DTSTART property
@@ -87,7 +87,7 @@ def dtend_property
# set the DTEND property
# property value should be an instance of either RiCal::PropertyValue::DateTime or RiCal::PropertyValue::Date
def dtend_property=(property_value)
- @dtend_property = property_value.for_parent(self)
+ @dtend_property = property_value ? property_value.for_parent(self) : nil
end
# set the value of the DTEND property
@@ -153,7 +153,7 @@ def dtstamp_property
# set the DTSTAMP property
# property value should be an instance of RiCal::PropertyValueDateTime
def dtstamp_property=(property_value)
- @dtstamp_property = property_value.for_parent(self)
+ @dtstamp_property = property_value ? property_value.for_parent(self) : nil
end
# set the value of the DTSTAMP property
@@ -54,7 +54,7 @@ def created_property
# set the CREATED property
# property value should be an instance of RiCal::PropertyValueDateTime
def created_property=(property_value)
- @created_property = property_value.for_parent(self)
+ @created_property = property_value ? property_value.for_parent(self) : nil
end
# set the value of the CREATED property
@@ -120,7 +120,7 @@ def dtstart_property
# set the DTSTART property
# property value should be an instance of either RiCal::PropertyValue::DateTime or RiCal::PropertyValue::Date
def dtstart_property=(property_value)
- @dtstart_property = property_value.for_parent(self)
+ @dtstart_property = property_value ? property_value.for_parent(self) : nil
end
# set the value of the DTSTART property
@@ -153,7 +153,7 @@ def dtstamp_property
# set the DTSTAMP property
# property value should be an instance of RiCal::PropertyValueDateTime
def dtstamp_property=(property_value)
- @dtstamp_property = property_value.for_parent(self)
+ @dtstamp_property = property_value ? property_value.for_parent(self) : nil
end
# set the value of the DTSTAMP property
@@ -186,7 +186,7 @@ def last_modified_property
# set the LAST-MODIFIED property
# property value should be an instance of RiCal::PropertyValueDateTime
def last_modified_property=(property_value)
- @last_modified_property = property_value.for_parent(self)
+ @last_modified_property = property_value ? property_value.for_parent(self) : nil
end
# set the value of the LAST-MODIFIED property
@@ -252,7 +252,7 @@ def recurrence_id_property
# set the RECURRENCE-ID property
# property value should be an instance of either RiCal::PropertyValue::DateTime or RiCal::PropertyValue::Date
def recurrence_id_property=(property_value)
- @recurrence_id_property = property_value.for_parent(self)
+ @recurrence_id_property = property_value ? property_value.for_parent(self) : nil
end
# set the value of the RECURRENCE-ID property
@@ -54,7 +54,7 @@ def last_modified_property
# set the LAST-MODIFIED property
# property value should be an instance of RiCal::PropertyValueDateTime
def last_modified_property=(property_value)
- @last_modified_property = property_value.for_parent(self)
+ @last_modified_property = property_value ? property_value.for_parent(self) : nil
end
# set the value of the LAST-MODIFIED property
@@ -21,7 +21,7 @@ def dtstart_property
# set the DTSTART property
# property value should be an instance of either RiCal::PropertyValue::DateTime or RiCal::PropertyValue::Date
def dtstart_property=(property_value)
- @dtstart_property = property_value.for_parent(self)
+ @dtstart_property = property_value ? property_value.for_parent(self) : nil
end
# set the value of the DTSTART property
@@ -1,6 +1,7 @@
module RiCal
module Properties #:nodoc:
- #- ©2009 Rick DeNatale, All rights reserved. Refer to the file README.txt for the license
+ #- ©2009 Rick DeNatale
+ #- All rights reserved. Refer to the file README.txt for the license
#
# Properties::Todo provides property accessing methods for the Todo class
# This source file is generated by the rical:gen_propmodules rake tasks, DO NOT EDIT
@@ -53,7 +54,7 @@ def completed_property
# set the COMPLETED property
# property value should be an instance of RiCal::PropertyValueDateTime
def completed_property=(property_value)
- @completed_property = property_value.for_parent(self)
+ @completed_property = property_value ? property_value.for_parent(self) : nil
end
# set the value of the COMPLETED property
@@ -86,7 +87,7 @@ def created_property
# set the CREATED property
# property value should be an instance of RiCal::PropertyValueDateTime
def created_property=(property_value)
- @created_property = property_value.for_parent(self)
+ @created_property = property_value ? property_value.for_parent(self) : nil
end
# set the value of the CREATED property
@@ -152,7 +153,7 @@ def dtstamp_property
# set the DTSTAMP property
# property value should be an instance of RiCal::PropertyValueDateTime
def dtstamp_property=(property_value)
- @dtstamp_property = property_value.for_parent(self)
+ @dtstamp_property = property_value ? property_value.for_parent(self) : nil
end
# set the value of the DTSTAMP property
@@ -185,7 +186,7 @@ def dtstart_property
# set the DTSTART property
# property value should be an instance of either RiCal::PropertyValue::DateTime or RiCal::PropertyValue::Date
def dtstart_property=(property_value)
- @dtstart_property = property_value.for_parent(self)
+ @dtstart_property = property_value ? property_value.for_parent(self) : nil
end
# set the value of the DTSTART property
@@ -251,7 +252,7 @@ def last_modified_property
# set the LAST-MODIFIED property
# property value should be an instance of RiCal::PropertyValueDateTime
def last_modified_property=(property_value)
- @last_modified_property = property_value.for_parent(self)
+ @last_modified_property = property_value ? property_value.for_parent(self) : nil
end
# set the value of the LAST-MODIFIED property
@@ -416,7 +417,7 @@ def recurrence_id_property
# set the RECURRENCE-ID property
# property value should be an instance of either RiCal::PropertyValue::DateTime or RiCal::PropertyValue::Date
def recurrence_id_property=(property_value)
- @recurrence_id_property = property_value.for_parent(self)
+ @recurrence_id_property = property_value ? property_value.for_parent(self) : nil
end
# set the value of the RECURRENCE-ID property
@@ -614,7 +615,7 @@ def due_property
# set the DUE property
# property value should be an instance of either RiCal::PropertyValue::DateTime or RiCal::PropertyValue::Date
def due_property=(property_value)
- @due_property = property_value.for_parent(self)
+ @due_property = property_value ? property_value.for_parent(self) : nil
@duration_property = nil
end
@@ -151,6 +151,14 @@ def start_of_day?
true
end
+ def to_zulu_occurrence_range_start_time
+ to_ri_cal_date_time_value.to_zulu_occurrence_range_start_time
+ end
+
+ def to_zulu_occurrence_range_finish_time
+ to_ri_cal_date_time_value.end_of_day.to_zulu_occurrence_range_finish_time
+ end
+
def to_finish_time
to_ri_cal_date_time_value.end_of_day.to_datetime
end
@@ -291,7 +291,34 @@ def ruby_value
alias_method :to_ri_cal_ruby_value, :to_datetime
alias_method :to_finish_time, :to_datetime
-
+
+ def to_zulu_time
+ utc.to_datetime
+ end
+
+ # If a time is floating, then the utc of it's start time may actually be as early
+ # as 12 hours earlier if the occurrence is being viewed in a time zone just west
+ # of the International Date Line
+ def to_zulu_occurrence_range_start_time
+ if floating?
+ utc.advance(:hours => -12).to_datetime
+ else
+ to_zulu_time
+ end
+ end
+
+
+ # If a time is floating, then the utc of it's start time may actually be as early
+ # as 12 hours later if the occurrence is being viewed in a time zone just east
+ # of the International Date Line
+ def to_zulu_occurrence_range_finish_time
+ if floating?
+ utc.advance(:hours => 12).to_datetime
+ else
+ to_zulu_time
+ end
+ end
+
def add_date_times_to(required_timezones) #:nodoc:
required_timezones.add_datetime(self, tzid) if has_local_timezone?
end
@@ -67,7 +67,7 @@ def utc?
# Predicate indicating whether or not the instance represents a floating time
def floating?
- tzid == :floating
+ tzid.nil?
end
def has_valid_tzinfo_tzid? #:nodoc:
View
@@ -2,11 +2,11 @@
Gem::Specification.new do |s|
s.name = %q{ri_cal}
- s.version = "0.0.11"
+ s.version = "0.5.0"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["author=Rick DeNatale"]
- s.date = %q{2009-05-23}
+ s.date = %q{2009-05-26}
s.default_executable = %q{ri_cal}
s.description = %q{This is an UNOFFICIAL version. The public official version will be released on RubyForge. Github will be used
for interim versions. USE THIS VERSION AT YOUR OWN RISK.
Oops, something went wrong.

0 comments on commit 5d9f1ca

Please sign in to comment.