class Vcard::V3_0::PropertyValue::Text

Public Class Methods

escape(x) click to toggle source
# File lib/vobject/vcard/v3_0/propertyvalue.rb, line 8
def escape(x)
  # temporarily escape \\ as \u007f, which is banned from text
  x.tr("\\", "\u007f").gsub(/\n/, "\\n").gsub(/,/, "\\,").gsub(/;/, "\\;").gsub(/\u007f/, "\\\\")
end
listencode(x) click to toggle source
# File lib/vobject/vcard/v3_0/propertyvalue.rb, line 13
def listencode(x)
  ret = if x.is_a?(Array)
          x.map { |m| Text.escape m }.join(",")
        elsif x.nil? || x.empty?
          ""
        else
          Text.escape x
        end
  ret
end
new(val) click to toggle source
# File lib/vobject/vcard/v3_0/propertyvalue.rb, line 25
def initialize(val)
  self.value = val
  self.type = "text"
end

Public Instance Methods

to_hash() click to toggle source
# File lib/vobject/vcard/v3_0/propertyvalue.rb, line 34
def to_hash
  value
end
to_s() click to toggle source
# File lib/vobject/vcard/v3_0/propertyvalue.rb, line 30
def to_s
  Text.escape value
end