lib/ri_cal/component.rb in rubyredrick-ri_cal-0.0.6 vs lib/ri_cal/component.rb in rubyredrick-ri_cal-0.0.7
- old
+ new
@@ -29,11 +29,11 @@
end
end
end
autoload :Timezone, "#{File.dirname(__FILE__)}/component/timezone.rb"
-
+
attr_accessor :imported #:nodoc:
def initialize(parent=nil, &init_block) #:nodoc:
@parent = parent
if block_given?
@@ -42,19 +42,19 @@
else
ComponentBuilder.new(self).instance_eval(&init_block)
end
end
end
-
+
def default_tzid #:nodoc:
if @parent
@parent.default_tzid
else
PropertyValue::DateTime.default_tzid
end
end
-
+
def find_timezone(identifier) #:nodoc:
if @parent
@parent.find_timezone(identifier)
else
begin
@@ -63,14 +63,22 @@
raise RiCal::InvalidTimezoneIdentifier.invalid_tzinfo_identifier(identifier)
end
end
end
+ def tz_info_source?
+ if @parent
+ @parent.tz_info_source?
+ else
+ true
+ end
+ end
+
def time_zone_for(ruby_object) #:nodoc:
@parent.time_zone_for(ruby_object) #:nodoc:
end
-
+
def subcomponent_class #:nodoc:
{}
end
def self.from_parser(parser, parent) #:nodoc:
@@ -85,19 +93,19 @@
end
def self.parse(io) #:nodoc:
Parser.new(io).parse
end
-
+
def imported? #:nodoc:
imported
end
def self.parse_string(string) #:nodoc:
parse(StringIO.new(string))
end
-
+
def subcomponents #:nodoc:
@subcomponents ||= Hash.new {|h, k| h[k] = []}
end
def entity_name #:nodoc:
@@ -135,15 +143,15 @@
# representing an extension to the RFC 2445 specification)
def x_properties
@x_properties ||= {}
end
- # Add a n extended property
+ # Add a n extended property
def add_x_property(name, prop)
x_properties[name] = prop
end
-
+
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)
@@ -200,10 +208,10 @@
def export_subcomponent_to(export_stream, subcomponent) #:nodoc:
subcomponent.each do |component|
component.export_to(export_stream)
end
end
-
+
# return a string containing the rfc2445 format of the component
def to_s
io = StringIO.new
export_to(io)
io.string
\ No newline at end of file