Class: Tilia::VObject::Property::Boolean
- Inherits:
-
Tilia::VObject::Property
- Object
- Node
- Tilia::VObject::Property
- Tilia::VObject::Property::Boolean
- Defined in:
- lib/tilia/v_object/property/boolean.rb
Overview
Boolean property.
This object represents BOOLEAN values. These are always the case-insenstive string TRUE or FALSE.
Automatic conversion to PHP’s true and false are done.
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
Instance Method Summary collapse
-
#raw_mime_dir_value ⇒ String
Returns a raw mime-dir representation of the value.
-
#raw_mime_dir_value=(val) ⇒ void
Sets a raw value coming from a mimedir (iCalendar/vCard) file.
-
#value_type ⇒ String
Returns the type of value.
-
#xml_value=(value) ⇒ void
Hydrate data from a XML subtree, as it would appear in a xCard or xCal object.
Methods inherited from Tilia::VObject::Property
#==, #[], #[]=, #add, #delete, #destroy, #initialize, #initialize_copy, #json_serialize, #json_value, #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
#raw_mime_dir_value ⇒ String
Returns a raw mime-dir representation of the value.
27 28 29 |
# File 'lib/tilia/v_object/property/boolean.rb', line 27 def raw_mime_dir_value @value ? 'TRUE' : 'FALSE' 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.
19 20 21 22 |
# File 'lib/tilia/v_object/property/boolean.rb', line 19 def raw_mime_dir_value=(val) val = val.upcase == 'TRUE' ? true : false self.value = val end |
#value_type ⇒ String
Returns the type of value.
This corresponds to the VALUE= parameter. Every property also has a ‘default’ valueType.
37 38 39 |
# File 'lib/tilia/v_object/property/boolean.rb', line 37 def value_type 'BOOLEAN' 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.
47 48 49 50 51 52 53 |
# File 'lib/tilia/v_object/property/boolean.rb', line 47 def xml_value=(value) value = value.map do |v| 'true' == v end super(value) end |