Class: Tilia::VObject::Component::VTimeZone
- Inherits:
-
Tilia::VObject::Component
- Object
- Node
- Tilia::VObject::Component
- Tilia::VObject::Component::VTimeZone
- Defined in:
- lib/tilia/v_object/component/v_time_zone.rb
Overview
The VTimeZone component.
This component adds functionality to a component, specific for VTIMEZONE components.
Constant Summary
Constants inherited from Node
Node::PROFILE_CALDAV, Node::PROFILE_CARDDAV, Node::REPAIR
Instance Attribute Summary
Attributes inherited from Tilia::VObject::Component
Attributes inherited from Node
Instance Method Summary collapse
-
#time_zone ⇒ ActiveSupport::TimeZone
Returns the PHP DateTimeZone for this VTIMEZONE component.
-
#validation_rules ⇒ array
A simple list of validation rules.
Methods inherited from Tilia::VObject::Component
#[], #[]=, #add, #children, #components, #delete, #destroy, #initialize, #initialize_copy, #json_serialize, #key?, #remove, #select, #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::Component
Instance Method Details
#time_zone ⇒ ActiveSupport::TimeZone
Returns the PHP DateTimeZone for this VTIMEZONE component.
If we can’t accurately determine the timezone, this method will return UTC.
15 16 17 |
# File 'lib/tilia/v_object/component/v_time_zone.rb', line 15 def time_zone Tilia::VObject::TimeZoneUtil.time_zone(self['TZID'].to_s, @root) end |
#validation_rules ⇒ array
A simple list of validation rules.
This is simply a list of properties, and how many times they either must or must not appear.
Possible values per property:
* 0 - Must not appear.
* 1 - Must appear exactly once.
* + - Must appear at least once.
* * - Can appear any number of times.
* ? - May appear, but not more than once.
It is also possible to specify defaults and severity levels for violating the rule.
See the VEVENT implementation for getValidationRules for a more complex example.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/tilia/v_object/component/v_time_zone.rb', line 20 def validation_rules { 'TZID' => 1, 'LAST-MODIFIED' => '?', 'TZURL' => '?', # At least 1 STANDARD or DAYLIGHT must appear, or more. But both # cannot appear in the same VTIMEZONE. # # The validator is not specific yet to pick this up, so these # rules are too loose. 'STANDARD' => '*', 'DAYLIGHT' => '*' } end |