Class: Vcard::V3_0::PropertyValue::Time
Instance Attribute Summary
#errors, #norm, #type, #value
Instance Method Summary
collapse
#<=>, #name, #to_norm
Constructor Details
#initialize(val) ⇒ Time
Returns a new instance of Time.
230
231
232
233
|
# File 'lib/vobject/vcard/v3_0/propertyvalue.rb', line 230
def initialize(val)
self.value = val
self.type = "time"
end
|
Instance Method Details
#to_hash ⇒ Object
245
246
247
|
# File 'lib/vobject/vcard/v3_0/propertyvalue.rb', line 245
def to_hash
value
end
|
#to_s ⇒ Object
235
236
237
238
239
240
241
242
243
|
# File 'lib/vobject/vcard/v3_0/propertyvalue.rb', line 235
def to_s
ret = "#{value[:hour]}:#{value[:min]}:#{value[:sec]}"
ret = ret + ".#{value[:secfrac]}" if value[:secfrac]
zone = ""
zone = "Z" if value[:zone] && value[:zone] == "Z"
zone = "#{value[:zone][:sign]}#{value[:zone][:hour]}:#{value[:zone][:min]}" if value[:zone] && value[:zone].is_a?(Hash)
ret = ret + zone
ret
end
|