Class: Vcard::V4_0::Property

Inherits:
Vobject::Property show all
Defined in:
lib/vobject/vcard/v4_0/property.rb

Instance Attribute Summary

Attributes inherited from Vobject::Property

#group, #multiple, #norm, #params, #prop_name, #value

Instance Method Summary collapse

Methods inherited from Vobject::Property

#<=>, #initialize, #to_hash, #to_norm, #to_s, #to_s_line

Constructor Details

This class inherits a constructor from Vobject::Property

Instance Method Details

#property_base_classObject

def parameter_base_class

  version_class.const_get(:Parameter)
end


13
14
15
# File 'lib/vobject/vcard/v4_0/property.rb', line 13

def property_base_class
  version_class.const_get(:Property)
end

#to_norm_lineObject

def to_norm

  puts "XXX"
  if norm.nil?
    if multiple.nil? || multiple.empty?
      ret = to_norm_line
    else
      arr = []
      multiple.sort.each do |x|
        arr << x.to_norm_line
      end
      ret = arr.join("")
    end
    norm = ret
  end
  norm
end


36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/vobject/vcard/v4_0/property.rb', line 36

def to_norm_line
  line = group ? "#{group}." : ""
  line << name.to_s.tr("_", "-").upcase

  # add mandatory VALUE param
  outparams = params
  if outparams.nil?
    outparams = []
  end
  outparams = outparams.select { |p| p.param_name != :VALUE }
  outparams << Vobject::Parameter.new(:VALUE, value.type)

  (outparams || {}).sort.each do |p|
    line << ";#{p.to_norm}"
  end

  line << ":#{value.to_norm}"

  line = Vobject::fold_line(line) << "\n"

  line
end

#version_classObject



59
60
61
# File 'lib/vobject/vcard/v4_0/property.rb', line 59

def version_class
  Vcard::V4_0
end