lib/ri_cal/component.rb in rubyredrick-ri_cal-0.0.2 vs lib/ri_cal/component.rb in rubyredrick-ri_cal-0.0.3
- old
+ new
@@ -1,10 +1,9 @@
module RiCal
- #- ©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
#
- class Component
+ class Component #:nodoc:
class ComponentBuilder #:nodoc:
def initialize(component)
@component = component
end
@@ -44,15 +43,31 @@
ComponentBuilder.new(self).instance_eval(&init_block)
end
end
end
- def find_timezone(identifier) #:nodoc:
- @parent.find_timezone(identifier)
+ def default_tzid #:nodoc:
+ if @parent
+ @parent.default_tzid
+ else
+ PropertyValue::DateTime.default_tzid
+ end
end
- def time_zone_for(ruby_object)
+ def find_timezone(identifier) #:nodoc:
+ if @parent
+ @parent.find_timezone(identifier)
+ else
+ begin
+ Calendar::TZInfoWrapper.new(TZInfo::Timezone.get(identifier), self)
+ rescue ::TZInfo::InvalidTimezoneIdentifier => ex
+ raise RiCal::InvalidTimezoneIdentifier.invalid_tzinfo_identifier(identifier)
+ end
+ end
+ end
+
+ def time_zone_for(ruby_object) #:nodoc:
@parent.time_zone_for(ruby_object) #:nodoc:
end
def subcomponent_class #:nodoc:
{}
@@ -125,10 +140,10 @@
# Add a n extended property
def add_x_property(name, prop)
x_properties[name] = prop
end
- def method_missing(selector, *args, &b)
+ def method_missing(selector, *args, &b) #:nodoc:
xprop_candidate = selector.to_s
if (match = /^x_(.+)(=?)$/.match(xprop_candidate))
if match[2] == "="
add_x_property("x_#{match[1]}", *args)
else
\ No newline at end of file