Class: Virginity::XSoocialCustom

Inherits:
BaseField show all
Defined in:
lib/virginity/vcard/fields_soocial.rb

Constant Summary collapse

PARTS =
%w(key_name value)

Constants inherited from BaseField

BaseField::BEGIN_REGEX, BaseField::END_REGEX, BaseField::PREF, BaseField::TYPE

Constants included from FieldCleaning

FieldCleaning::BOM_BINARY, FieldCleaning::BOM_UTF8, FieldCleaning::CASE_SENSITIVE_TYPES, FieldCleaning::CHARSET, FieldCleaning::ENCODING, FieldCleaning::LIST_NAMES, FieldCleaning::QUOTED_PRINTABLE, FieldCleaning::TYPE, FieldCleaning::X_SYNTHESIS_REF

Constants inherited from ContentLine

ContentLine::COLON_CHAR, ContentLine::GROUP, ContentLine::GROUP_DELIMITER, ContentLine::NAME

Instance Attribute Summary

Attributes inherited from ContentLine

#group, #name, #params

Instance Method Summary collapse

Methods inherited from BaseField

#<=>, #==, [], #extra_fields_to_xml, #field_as_json, field_register, #group_and_params_as_json, merger, named, #params_to_xml, #params_to_xml!, parse, #pref?, #raw_value=, register_field, register_for, registered?, #to_xml, types, unregister, #value=, #value_to_xml

Methods included from FieldCleaning

#clean!, #clean_base64!, #clean_binary_data!, #clean_charsets!, #clean_quoted_printable_encoding!, #clean_types!, #guess_latin!, #remove_bom!, #remove_encoding_8bit!, #remove_x_synthesis_ref_params!, #uniq_params!

Methods included from Vcard21::Writer

#encode21, #vcard21line

Methods inherited from ContentLine

#<=>, #==, #api_id, #encode, #eql?, #has_name?, #hash, #initialize, line_parts, #merge_with!, merger, #param_values, #params_to_s, parse, #pretty_print, #to_field

Methods included from Encodings

#binary?, #to_ascii, #to_binary, #to_default, #to_default!, #verify_utf8ness

Constructor Details

This class inherits a constructor from Virginity::ContentLine

Instance Method Details

#key_nameObject



13
14
15
16
# File 'lib/virginity/vcard/fields_soocial.rb', line 13

def key_name
  rewrite_old_kv!
  super
end

#rewrite_old_kv!Object



31
32
33
34
35
36
# File 'lib/virginity/vcard/fields_soocial.rb', line 31

def rewrite_old_kv!
  if name = params('NAME')[0]
    self.key_name, self.value = name.value, EncodingDecoding.decode_text(raw_value)
    params.delete_if { |p| p.key == "NAME" }
  end
end

#textObject



18
19
20
# File 'lib/virginity/vcard/fields_soocial.rb', line 18

def text
  value
end

#text=(txt) ⇒ Object



22
23
24
# File 'lib/virginity/vcard/fields_soocial.rb', line 22

def text=(txt)
  self.value = txt
end

#to_sObject



26
27
28
29
# File 'lib/virginity/vcard/fields_soocial.rb', line 26

def to_s
  rewrite_old_kv!
  super
end

#valueObject



8
9
10
11
# File 'lib/virginity/vcard/fields_soocial.rb', line 8

def value
  rewrite_old_kv!
  super
end