Class: Tilia::VObject::Property::UtcOffset
- Inherits:
-
Text
- Object
- Node
- Tilia::VObject::Property
- Text
- Tilia::VObject::Property::UtcOffset
- Defined in:
- lib/tilia/v_object/property/utc_offset.rb
Overview
UtcOffset property.
This object encodes UTC-OFFSET 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) ⇒ UtcOffset
constructor
A new instance of UtcOffset.
-
#json_value ⇒ array
Returns the value, in the format it should be encoded for JSON.
-
#json_value=(value) ⇒ void
Sets the JSON value, as it would appear in a jCard or jCal object.
-
#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, #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) ⇒ UtcOffset
Returns a new instance of UtcOffset.
49 50 51 52 |
# File 'lib/tilia/v_object/property/utc_offset.rb', line 49 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.
12 13 14 |
# File 'lib/tilia/v_object/property/utc_offset.rb', line 12 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.
43 44 45 46 47 |
# File 'lib/tilia/v_object/property/utc_offset.rb', line 43 def json_value super.map do |value| "#{value[0...-2]}:#{value[-2..-1]}" end end |
#json_value=(value) ⇒ void
This method returns an undefined value.
Sets the JSON value, as it would appear in a jCard or jCal object.
The value must always be an array.
31 32 33 34 35 36 |
# File 'lib/tilia/v_object/property/utc_offset.rb', line 31 def json_value=(value) value = value.map do |v| v.delete(':') end super(value) end |
#value_type ⇒ String
Returns the type of value.
This corresponds to the VALUE= parameter. Every property also has a ‘default’ valueType.
20 21 22 |
# File 'lib/tilia/v_object/property/utc_offset.rb', line 20 def value_type 'UTC-OFFSET' end |