Class: Tilia::VObject::Property::VCard::TimeStamp
- Inherits:
-
Text
- Object
- Node
- Tilia::VObject::Property
- Text
- Tilia::VObject::Property::VCard::TimeStamp
- Defined in:
- lib/tilia/v_object/property/v_card/time_stamp.rb
Overview
TimeStamp property.
This object encodes TIMESTAMP values.
Constant Summary
Constants inherited from Node
Node::PROFILE_CALDAV, Node::PROFILE_CARDDAV, Node::REPAIR
Instance Attribute Summary collapse
-
#delimiter ⇒ String?
In case this is a multi-value property.
Attributes inherited from Tilia::VObject::Property
#group, #name, #parameters, #value
Attributes inherited from Node
Instance Method Summary collapse
-
#initialize(*args) ⇒ TimeStamp
constructor
A new instance of TimeStamp.
-
#json_value ⇒ array
Returns the value, in the format it should be encoded for json.
-
#value_type ⇒ String
Returns the type of value.
Methods inherited from Text
#quoted_printable_value=, #raw_mime_dir_value, #raw_mime_dir_value=, #serialize, #validate
Methods inherited from Tilia::VObject::Property
#==, #[], #[]=, #add, #delete, #destroy, #initialize_copy, #json_serialize, #json_value=, #key?, #parts, #parts=, #raw_mime_dir_value, #raw_mime_dir_value=, #serialize, #to_s, #validate, #xml_serialize, #xml_value=
Methods inherited from Node
#==, #[], #[]=, #delete, #destroy, #each, #json_serialize, #key?, #serialize, #size, #validate, #xml_serialize
Constructor Details
#initialize(*args) ⇒ TimeStamp
Returns a new instance of TimeStamp.
66 67 68 69 |
# File 'lib/tilia/v_object/property/v_card/time_stamp.rb', line 66 def initialize(*args) super(*args) @delimiter = nil end |
Instance Attribute Details
#delimiter ⇒ String?
In case this is a multi-value property. This string will be used as a delimiter.
13 14 15 |
# File 'lib/tilia/v_object/property/v_card/time_stamp.rb', line 13 def delimiter @delimiter end |
Instance Method Details
#json_value ⇒ array
Returns the value, in the format it should be encoded for json.
This method must always return an array.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# 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 ⇒ String
Returns the type of value.
This corresponds to the VALUE= parameter. Every property also has a ‘default’ valueType.
21 22 23 |
# File 'lib/tilia/v_object/property/v_card/time_stamp.rb', line 21 def value_type 'TIMESTAMP' end |