Class: Vcard::V3_0::PropertyValue::Text
Instance Attribute Summary
#errors, #norm, #type, #value
Class Method Summary
collapse
Instance Method Summary
collapse
#<=>, #name, #to_norm
Constructor Details
#initialize(val) ⇒ Text
Returns a new instance of Text.
25
26
27
28
|
# File 'lib/vobject/vcard/v3_0/propertyvalue.rb', line 25
def initialize(val)
self.value = val
self.type = "text"
end
|
Class Method Details
.escape(x) ⇒ Object
8
9
10
11
|
# File 'lib/vobject/vcard/v3_0/propertyvalue.rb', line 8
def escape(x)
x.tr("\\", "\u007f").gsub(/\n/, "\\n").gsub(/,/, "\\,").gsub(/;/, "\\;").gsub(/\u007f/, "\\\\")
end
|
.listencode(x) ⇒ Object
13
14
15
16
17
18
19
20
21
22
|
# 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
|
Instance Method Details
#to_hash ⇒ Object
34
35
36
|
# File 'lib/vobject/vcard/v3_0/propertyvalue.rb', line 34
def to_hash
value
end
|
#to_s ⇒ Object
30
31
32
|
# File 'lib/vobject/vcard/v3_0/propertyvalue.rb', line 30
def to_s
Text.escape value
end
|