class Tilia::VObject::Property::FlatText

FlatText property.

This object represents certain TEXT values.

Specifically, this property is used for text values where there is only 1 part. Semi-colons and colons will be de-escaped when deserializing, but if any semi-colons or commas appear without a backslash, we will not assume that they are delimiters.

vCard 2.1 specifically has a whole bunch of properties where this may happen, as it only defines a delimiter for a few properties.

vCard 4.0 states something similar. An unescaped semi-colon may be a delimiter, depending on the property.

Attributes

delimiter[RW]

Field separator.

@return [String]

Public Class Methods

new(*args) click to toggle source
Calls superclass method Tilia::VObject::Property::Text::new
# File lib/tilia/v_object/property/flat_text.rb, line 45
def initialize(*args)
  super(*args)
  @delimiter = ','
end

Public Instance Methods

quoted_printable_value=(val) click to toggle source

Sets the value as a quoted-printable encoded string.

Overriding this so we're not splitting on a ; delimiter.

@param [String] val

@return [void]

# File lib/tilia/v_object/property/flat_text.rb, line 31
def quoted_printable_value=(val)
  val = Mail::Encodings::QuotedPrintable.decode(val)
  val = val.gsub(/\n/, "\r\n").gsub(/\r\r/, "\r")

  # force the correct encoding
  begin
    val.force_encoding(Encoding.find(@parameters['CHARSET'].to_s))
  rescue
    val.force_encoding(Encoding::UTF_8)
  end

  self.value = val
end