Sha256: 9e8d4cc66c92213bc52741412b9b14d974ce0b5b2d64e994a3b973f4dbc56da0

Contents?: true

Size: 1.2 KB

Versions: 6

Compression:

Stored size: 1.2 KB

Contents

require "vobject/property"
require "vobject/parameter"
require "pp"

module Vcard::V4_0
  class Property < Vobject::Property
=begin
    def parameter_base_class
      version_class.const_get(:Parameter)
    end
=end

    def property_base_class
      version_class.const_get(:Property)
    end

=begin
    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
=end

    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

    def version_class
      Vcard::V4_0
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
vobject-1.1.0 lib/vobject/vcard/v4_0/property.rb
ruby-vobject-1.0.99 lib/vobject/vcard/v4_0/property.rb
vobject-1.0.2 lib/vobject/vcard/v4_0/property.rb
ruby-vobject-1.0.1 lib/vobject/vcard/v4_0/property.rb
ruby-vobject-1.0.0-x86_64-darwin-18 lib/vobject/vcard/v4_0/property.rb
ruby-vobject-0.2.0-x86_64-darwin-16 lib/vobject/vcard/v4_0/property.rb