Class: Icalendar::Values::Text
- Inherits:
-
Icalendar::Value
- Object
- SimpleDelegator
- Icalendar::Value
- Icalendar::Values::Text
- Defined in:
- lib/icalendar/values/text.rb
Constant Summary collapse
- VALUE_ICAL_CARRIAGE_RETURN_GSUB_REGEX =
/\r?\n/.freeze
Constants inherited from Icalendar::Value
Icalendar::Value::VALUE_TYPE_GSUB_REGEX_1, Icalendar::Value::VALUE_TYPE_GSUB_REGEX_2
Instance Attribute Summary
Attributes inherited from Icalendar::Value
Instance Method Summary collapse
-
#initialize(value, params = {}) ⇒ Text
constructor
A new instance of Text.
- #value_ical ⇒ Object
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.
6 7 8 9 10 11 12 |
# File 'lib/icalendar/values/text.rb', line 6 def initialize(value, params = {}) value = value.gsub('\n', "\n") value.gsub!('\,', ',') value.gsub!('\;', ';') value.gsub!('\\\\') { '\\' } super value, params end |
Instance Method Details
#value_ical ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/icalendar/values/text.rb', line 16 def value_ical value.dup.tap do |v| v.gsub!('\\') { '\\\\' } v.gsub!(';', '\;') v.gsub!(',', '\,') v.gsub!(VALUE_ICAL_CARRIAGE_RETURN_GSUB_REGEX, '\n') end end |