Module: RiCal::CoreExtensions::String::Conversions
- Included in:
- String
- Defined in:
- lib/ri_cal/core_extensions/string.rb
Overview
:nodoc:
Instance Method Summary collapse
- #to_ri_cal_date_or_date_time_value(timezone_finder = nil) ⇒ Object
-
#to_ri_cal_date_time_value(timezone_finder = nil) ⇒ Object
Parse the receiver as an RiCal::PropertyValue::DateTime.
-
#to_ri_cal_duration_value(timezone_finder = nil) ⇒ Object
Parse the receiver as an RiCal::PropertyValue::DurationValue.
- #to_ri_cal_occurrence_list_value(timezone_finder = nil) ⇒ Object
- #to_ri_cal_text_property ⇒ Object
Instance Method Details
#to_ri_cal_date_or_date_time_value(timezone_finder = nil) ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/ri_cal/core_extensions/string.rb', line 20 def to_ri_cal_date_or_date_time_value(timezone_finder = nil) params, value = *Parser.params_and_value(self, :no_leading_semicolon) if PropertyValue::DateTime.valid_string?(value) || PropertyValue::Date.valid_string?(value) PropertyValue.date_or_date_time(timezone_finder, :params => params, :value => value) else raise InvalidPropertyValue.new("#{self.inspect} is not a valid rfc 2445 date or date-time") end end |
#to_ri_cal_date_time_value(timezone_finder = nil) ⇒ Object
Parse the receiver as an RiCal::PropertyValue::DateTime
10 11 12 13 14 15 16 17 |
# File 'lib/ri_cal/core_extensions/string.rb', line 10 def to_ri_cal_date_time_value(timezone_finder = nil) params, value = *Parser.params_and_value(self, :no_leading_semicolon) if PropertyValue::DateTime.valid_string?(value) PropertyValue::DateTime.new(timezone_finder, :params => params, :value => value) else raise InvalidPropertyValue.new("#{self.inspect} is not a valid rfc 2445 date-time") end end |
#to_ri_cal_duration_value(timezone_finder = nil) ⇒ Object
Parse the receiver as an RiCal::PropertyValue::DurationValue
30 31 32 33 34 35 36 37 |
# File 'lib/ri_cal/core_extensions/string.rb', line 30 def to_ri_cal_duration_value(timezone_finder = nil) params, value = *Parser.params_and_value(self) if PropertyValue::Duration.valid_string?(value) PropertyValue::Duration.new(timezone_finder, :params => params, :value => value) else raise InvalidPropertyValue.new("#{self.inspect} is not a valid rfc 2445 duration") end end |
#to_ri_cal_occurrence_list_value(timezone_finder = nil) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/ri_cal/core_extensions/string.rb', line 39 def to_ri_cal_occurrence_list_value(timezone_finder = nil) params, value = *Parser.params_and_value(self, :no_leading_semicolon) if PropertyValue::DateTime.valid_string?(value) PropertyValue::DateTime.new(timezone_finder, :params => params, :value => value) elsif PropertyValue::Date.valid_string?(value) PropertyValue::Date.new(timezone_finder, :params => params, :value => value) elsif PropertyValue::Period.valid_string?(value) PropertyValue::Period.new(timezone_finder, :params => params, :value => value) else raise "Invalid value for occurrence list #{self.inspect}" end end |
#to_ri_cal_text_property ⇒ Object
5 6 7 |
# File 'lib/ri_cal/core_extensions/string.rb', line 5 def to_ri_cal_text_property PropertyValue::Text.new(nil, :value => self) end |