Class: Icalendar2::TextValue
- Defined in:
- lib/icalendar2/value/text_value.rb
Overview
See tools.ietf.org/html/rfc5545#section-3.3.11 This will escape text passed in, so do not escape it first!
Instance Attribute Summary
Attributes inherited from Value
Instance Method Summary collapse
-
#initialize(value) ⇒ TextValue
constructor
A new instance of TextValue.
Methods inherited from Value
get_factory, matches, #to_s, #valid?
Constructor Details
#initialize(value) ⇒ TextValue
Returns a new instance of TextValue.
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/icalendar2/value/text_value.rb', line 6 def initialize(value) replacements = { '\\' => '\\\\', ';' => '\;', ',' => '\,', "\r\n" => "\n", "\r" => "\n" } super(value.respond_to?(:gsub) ? value.gsub(/\\|;|,|\r\n|\r/, replacements) : value) end |