Class: Tilia::VObject::Property::FlatText
- Inherits:
-
Text
- Object
- Node
- Tilia::VObject::Property
- Text
- Tilia::VObject::Property::FlatText
- Defined in:
- lib/tilia/v_object/property/flat_text.rb
Overview
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.
Constant Summary
Constants inherited from Node
Node::PROFILE_CALDAV, Node::PROFILE_CARDDAV, Node::REPAIR
Instance Attribute Summary collapse
-
#delimiter ⇒ String
Field separator.
Attributes inherited from Tilia::VObject::Property
#group, #name, #parameters, #value
Attributes inherited from Node
Instance Method Summary collapse
-
#initialize(*args) ⇒ FlatText
constructor
A new instance of FlatText.
-
#quoted_printable_value=(val) ⇒ void
Sets the value as a quoted-printable encoded string.
Methods inherited from Text
#json_value, #raw_mime_dir_value, #raw_mime_dir_value=, #serialize, #validate, #value_type
Methods inherited from Tilia::VObject::Property
#==, #[], #[]=, #add, #delete, #destroy, #initialize_copy, #json_serialize, #json_value, #json_value=, #key?, #parts, #parts=, #raw_mime_dir_value, #raw_mime_dir_value=, #serialize, #to_s, #validate, #value_type, #xml_serialize, #xml_value=
Methods inherited from Node
#==, #[], #[]=, #delete, #destroy, #each, #json_serialize, #key?, #serialize, #size, #validate, #xml_serialize
Constructor Details
#initialize(*args) ⇒ FlatText
Returns a new instance of FlatText.
45 46 47 48 |
# File 'lib/tilia/v_object/property/flat_text.rb', line 45 def initialize(*args) super(*args) @delimiter = ',' end |
Instance Attribute Details
#delimiter ⇒ String
Field separator.
22 23 24 |
# File 'lib/tilia/v_object/property/flat_text.rb', line 22 def delimiter @delimiter end |
Instance Method Details
#quoted_printable_value=(val) ⇒ void
This method returns an undefined value.
Sets the value as a quoted-printable encoded string.
Overriding this so we’re not splitting on a ; delimiter.
31 32 33 34 35 36 37 38 39 40 41 42 43 |
# 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 |