class Vcard::V4_0::PropertyValue::Text
Public Class Methods
escape(x)
click to toggle source
# File lib/vobject/vcard/v4_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(/\u007f/, "\\\\") end
escape_component(x)
click to toggle source
# File lib/vobject/vcard/v4_0/propertyvalue.rb, line 13 def escape_component(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/v4_0/propertyvalue.rb, line 18 def listencode(x) ret = if x.is_a?(Array) x.map { |m| Text.escape_component m }.join(",") elsif x.nil? || x.empty? "" else Text.escape_component x end ret end
new(val)
click to toggle source
# File lib/vobject/vcard/v4_0/propertyvalue.rb, line 30 def initialize(val) self.value = val self.type = "text" end
Public Instance Methods
to_hash()
click to toggle source
# File lib/vobject/vcard/v4_0/propertyvalue.rb, line 39 def to_hash value end
to_s()
click to toggle source
# File lib/vobject/vcard/v4_0/propertyvalue.rb, line 35 def to_s Text.escape value end