Sha256: 980cc6700e47d8456511e296c80b89be965fd3d00048d8d9e22c800c2bb572d3

Contents?: true

Size: 679 Bytes

Versions: 6

Compression:

Stored size: 679 Bytes

Contents

module Vobject
  class PropertyValue
    attr_accessor :value, :type, :errors, :norm

    def <=>(another)
      self.value <=> another.value
    end

    def initialize(val)
      self.value = val
      self.type = "text" # safe default
      self.norm = nil
    end

    # raise_invalid_initialization if key != name

    def to_s
      value
    end

    def to_norm
      if norm.nil?
        norm = to_s
      end
      norm
    end

    def to_hash
      value
    end

    def name
      type
    end

    private

    def default_value_type
      "text"
    end

    def raise_invalid_initialization
      raise "vObject property initialization failed"
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

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