Class: Tilia::VObject::Property::IntegerValue

Inherits:
Tilia::VObject::Property show all
Defined in:
lib/tilia/v_object/property/integer_value.rb

Overview

Integer property.

This object represents INTEGER values. These are always a single integer. They may be preceeded by either + or -.

Constant Summary

Constants inherited from Node

Node::PROFILE_CALDAV, Node::PROFILE_CARDDAV, Node::REPAIR

Instance Attribute Summary

Attributes inherited from Tilia::VObject::Property

#delimiter, #group, #name, #parameters, #value

Attributes inherited from Node

#iterator, #parent

Instance Method Summary collapse

Methods inherited from Tilia::VObject::Property

#==, #[], #[]=, #add, #delete, #destroy, #initialize, #initialize_copy, #json_serialize, #json_value=, #key?, #parts, #parts=, #serialize, #to_s, #validate, #xml_serialize

Methods inherited from Node

#==, #[], #[]=, #delete, #destroy, #each, #initialize, #json_serialize, #key?, #serialize, #size, #validate, #xml_serialize

Constructor Details

This class inherits a constructor from Tilia::VObject::Property

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
# File 'lib/tilia/v_object/property/integer_value.rb', line 43

def json_value
  [value.to_i]
end

#raw_mime_dir_valueString

Returns a raw mime-dir representation of the value.

Returns:

  • (String)


24
25
26
# File 'lib/tilia/v_object/property/integer_value.rb', line 24

def raw_mime_dir_value
  @value
end

#raw_mime_dir_value=(val) ⇒ void

This method returns an undefined value.

Sets a raw value coming from a mimedir (iCalendar/vCard) file.

This has been ‘unfolded’, so only 1 line will be passed. Unescaping is not yet done, but parameters are not included.

Parameters:

  • val (String)


17
18
19
# File 'lib/tilia/v_object/property/integer_value.rb', line 17

def raw_mime_dir_value=(val)
  self.value = val.to_i
end

#value_typeString

Returns the type of value.

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

Returns:

  • (String)


34
35
36
# File 'lib/tilia/v_object/property/integer_value.rb', line 34

def value_type
  'INTEGER'
end

#xml_value=(value) ⇒ void

This method returns an undefined value.

Hydrate data from a XML subtree, as it would appear in a xCard or xCal object.

Parameters:

  • value (array)


53
54
55
56
# File 'lib/tilia/v_object/property/integer_value.rb', line 53

def xml_value=(value)
  value = value.map(&:to_i)
  super(value)
end