Class: RiCal::PropertyValue::Text

Inherits:
RiCal::PropertyValue show all
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

Instance Method Summary collapse

Methods inherited from RiCal::PropertyValue

#==, #add_date_times_to, date_or_date_time, #enumerator, #equality_value, #for_parent, from_string, #initialize, #parms_string, #to_options_hash, #to_ri_cal_property_value, #to_s, #validate_value, #visible_params

Constructor Details

This class inherits a constructor from RiCal::PropertyValue

Class Method Details

.convert(parent, string) ⇒ Object

:nodoc:



29
30
31
32
33
34
35
36
37
38
# File 'lib/ri_cal/property_value/text.rb', line 29

def self.convert(parent, string) #:nodoc:
  ical_str = string.gsub(/\n|,|;/) {|match|
    if match == "\n"
      '\n'
    else
      "\\#{match}"
    end
    }
  self.new(parent, :value => ical_str)
end

Instance Method Details

#ruby_valueObject

Return the string value of the receiver



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/ri_cal/property_value/text.rb', line 12

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