Class: Vobject::PropertyValue

Inherits:
Object
  • Object
show all
Defined in:
lib/vobject/propertyvalue.rb

Direct Known Subclasses

Vcard::V3_0::PropertyValue::Address, Vcard::V3_0::PropertyValue::Agent, Vcard::V3_0::PropertyValue::Date, Vcard::V3_0::PropertyValue::DateTimeLocal, Vcard::V3_0::PropertyValue::Fivepartname, Vcard::V3_0::PropertyValue::Float, Vcard::V3_0::PropertyValue::Geovalue, Vcard::V3_0::PropertyValue::Integer, Vcard::V3_0::PropertyValue::Org, Vcard::V3_0::PropertyValue::Text, Vcard::V3_0::PropertyValue::Textlist, Vcard::V3_0::PropertyValue::Time, Vcard::V3_0::PropertyValue::Utcoffset, Vcard::V3_0::PropertyValue::Version, Vcard::V4_0::PropertyValue::Address, Vcard::V4_0::PropertyValue::Date, Vcard::V4_0::PropertyValue::DateTimeLocal, Vcard::V4_0::PropertyValue::Fivepartname, Vcard::V4_0::PropertyValue::Float, Vcard::V4_0::PropertyValue::Gender, Vcard::V4_0::PropertyValue::Integer, Vcard::V4_0::PropertyValue::Org, Vcard::V4_0::PropertyValue::Text, Vcard::V4_0::PropertyValue::Textlist, Vcard::V4_0::PropertyValue::Time, Vcard::V4_0::PropertyValue::Utcoffset, Vcard::V4_0::PropertyValue::Version, Vcalendar::PropertyValue::Boolean, Vcalendar::PropertyValue::Calscale, Vcalendar::PropertyValue::Date, Vcalendar::PropertyValue::DateTimeLocal, Vcalendar::PropertyValue::DateTimeUTC, Vcalendar::PropertyValue::Datelist, Vcalendar::PropertyValue::Datetimelist, Vcalendar::PropertyValue::Datetimeutclist, Vcalendar::PropertyValue::Duration, Vcalendar::PropertyValue::Float, Vcalendar::PropertyValue::Geovalue, Vcalendar::PropertyValue::Integer, Vcalendar::PropertyValue::Periodlist, Vcalendar::PropertyValue::Recur, Vcalendar::PropertyValue::Requeststatusvalue, Vcalendar::PropertyValue::Text, Vcalendar::PropertyValue::Textlist, Vcalendar::PropertyValue::Time, Vcalendar::PropertyValue::Utcoffset, Vcalendar::PropertyValue::Version

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(val) ⇒ PropertyValue

Returns a new instance of PropertyValue.



9
10
11
12
13
# File 'lib/vobject/propertyvalue.rb', line 9

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

Instance Attribute Details

#errorsObject

Returns the value of attribute errors.



3
4
5
# File 'lib/vobject/propertyvalue.rb', line 3

def errors
  @errors
end

#normObject

Returns the value of attribute norm.



3
4
5
# File 'lib/vobject/propertyvalue.rb', line 3

def norm
  @norm
end

#typeObject

Returns the value of attribute type.



3
4
5
# File 'lib/vobject/propertyvalue.rb', line 3

def type
  @type
end

#valueObject

Returns the value of attribute value.



3
4
5
# File 'lib/vobject/propertyvalue.rb', line 3

def value
  @value
end

Instance Method Details

#<=>(another) ⇒ Object



5
6
7
# File 'lib/vobject/propertyvalue.rb', line 5

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

#nameObject



32
33
34
# File 'lib/vobject/propertyvalue.rb', line 32

def name
  type
end

#to_hashObject



28
29
30
# File 'lib/vobject/propertyvalue.rb', line 28

def to_hash
  value
end

#to_normObject



21
22
23
24
25
26
# File 'lib/vobject/propertyvalue.rb', line 21

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

#to_sObject

raise_invalid_initialization if key != name



17
18
19
# File 'lib/vobject/propertyvalue.rb', line 17

def to_s
  value
end