Class: Icalendar::Values::Text

Inherits:
Icalendar::Value show all
Defined in:
lib/icalendar/values/text.rb

Instance Attribute Summary

Attributes inherited from Icalendar::Value

#ical_params

Instance Method Summary collapse

Methods inherited from Icalendar::Value

#ical_param, #params_ical, #to_ical, #value, value_type, #value_type

Constructor Details

#initialize(value, params = {}) ⇒ Text

Returns a new instance of Text.


4
5
6
7
8
9
10
# File 'lib/icalendar/values/text.rb', line 4

def initialize(value, params = {})
  value = value.gsub('\n', "\n")
  value.gsub!('\,', ',')
  value.gsub!('\;', ';')
  value.gsub!('\\\\') { '\\' }
  super value, params
end

Instance Method Details

#value_icalObject


12
13
14
15
16
17
18
19
# File 'lib/icalendar/values/text.rb', line 12

def value_ical
  value.dup.tap do |v|
    v.gsub!('\\') { '\\\\' }
    v.gsub!(';', '\;')
    v.gsub!(',', '\,')
    v.gsub!(/\r?\n/, '\n')
  end
end