class Tilia::VObject::Property::VCard::TimeStamp
TimeStamp
property.
This object encodes TIMESTAMP values.
Attributes
delimiter[RW]
In case this is a multi-value property. This string will be used as a delimiter.
@return [String, nil]
Public Class Methods
new(*args)
click to toggle source
Calls superclass method
Tilia::VObject::Property::Text::new
# File lib/tilia/v_object/property/v_card/time_stamp.rb, line 66 def initialize(*args) super(*args) @delimiter = nil end
Public Instance Methods
json_value()
click to toggle source
Returns the value, in the format it should be encoded for json.
This method must always return an array.
@return [array]
# File lib/tilia/v_object/property/v_card/time_stamp.rb, line 30 def json_value parts = DateTimeParser.parse_v_card_date_time(value) date_str = format( '%04i-%02i-%02iT%02i:%02i:%02i', parts['year'], parts['month'], parts['date'], parts['hour'], parts['minute'], parts['second'] ) # Timezone date_str += parts['timezone'] unless parts['timezone'].blank? [date_str] end
value_type()
click to toggle source
Returns the type of value.
This corresponds to the VALUE= parameter. Every property also has a 'default' valueType.
@return [String]
# File lib/tilia/v_object/property/v_card/time_stamp.rb, line 21 def value_type 'TIMESTAMP' end
Protected Instance Methods
xml_serialize_value(writer)
click to toggle source
This method serializes only the value of a property. This is used to create xCard or xCal documents.
@param [XmlWriter] writer XML writer.
@return [void]
# File lib/tilia/v_object/property/v_card/time_stamp.rb, line 57 def xml_serialize_value(writer) # xCard is the only XML and JSON format that has the same date and time # format than vCard. value_type = self.value_type.downcase writer.write_element(value_type, value) end