Class: Tilia::VObject::Property::UtcOffset

Inherits:
Text show all
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

Attributes inherited from Tilia::VObject::Property

#group, #name, #parameters, #value

Attributes inherited from Node

#iterator, #parent

Instance Method Summary collapse

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

#delimiterString?

In case this is a multi-value property. This string will be used as a delimiter.

Returns:

  • (String, nil)


12
13
14
# File 'lib/tilia/v_object/property/utc_offset.rb', line 12

def delimiter
  @delimiter
end

Instance Method Details

#json_valuearray

Returns the value, in the format it should be encoded for JSON.

This method must always return an array.

Returns:

  • (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.

Parameters:

  • value (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_typeString

Returns the type of value.

This corresponds to the VALUE= parameter. Every property also has a ‘default’ valueType.

Returns:

  • (String)


20
21
22
# File 'lib/tilia/v_object/property/utc_offset.rb', line 20

def value_type
  'UTC-OFFSET'
end