Class: RiCal::PropertyValue::Text
- Inherits:
-
RiCal::PropertyValue
- Object
- RiCal::PropertyValue
- RiCal::PropertyValue::Text
- Defined in:
- lib/ri_cal/property_value/text.rb
Overview
-
©2009 Rick DeNatale, All rights reserved. Refer to the file README.txt for the license
RiCal::PropertyValue::Text represents an icalendar Text property value which is defined in rfc 2445 section 4.3.11 pp 45-46
Instance Attribute Summary
Attributes inherited from RiCal::PropertyValue
#params, #timezone_finder, #value
Class Method Summary collapse
-
.convert(parent, string) ⇒ Object
:nodoc:.
Instance Method Summary collapse
-
#ruby_value ⇒ Object
Return the string value of the receiver.
Methods inherited from RiCal::PropertyValue
#==, #add_date_times_to, date_or_date_time, date_or_date_time_or_period, #default_tzid, #enumerator, #equality_value, #find_timezone, #for_parent, if_valid_string, #initialize, #parms_string, #to_options_hash, #to_ri_cal_property_value, #to_s, #tz_info_source?, #validate_value, #visible_params
Constructor Details
This class inherits a constructor from RiCal::PropertyValue
Class Method Details
.convert(parent, string) ⇒ Object
:nodoc:
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/ri_cal/property_value/text.rb', line 28 def self.convert(parent, string) #:nodoc: ical_str = string.gsub(/\n\r?|\r\n?|,|;|\\/) {|match| if ["\n", "\r", "\n\r", "\r\n"].include?(match) '\\n' else "\\#{match}" end } self.new(parent, :value => ical_str) end |
Instance Method Details
#ruby_value ⇒ Object
Return the string value of the receiver
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/ri_cal/property_value/text.rb', line 11 def ruby_value if value value.gsub(/\\[;,nN\\]/) {|match| case match[1,1] when /[,;\\]/ match[1,1] when 'n', 'N' "\n" else match end } else nil end end |