Class: Icalendar::Alarm
Instance Attribute Summary
Attributes inherited from Component
Instance Method Summary collapse
-
#initialize ⇒ Alarm
constructor
A new instance of Alarm.
- #valid?(strict = false) ⇒ Boolean
Methods inherited from Component
Methods included from HasComponents
#add_component, included, #method_missing, #respond_to_missing?
Methods included from HasProperties
#append_custom_property, #custom_property, included, #method_missing, #property, #respond_to_missing?
Constructor Details
#initialize ⇒ Alarm
Returns a new instance of Alarm.
23 24 25 |
# File 'lib/icalendar/alarm.rb', line 23 def initialize super 'alarm' end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Icalendar::HasComponents
Instance Method Details
#valid?(strict = false) ⇒ Boolean
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/icalendar/alarm.rb', line 27 def valid?(strict = false) if strict # must be part of event or todo !(parent.nil? || parent.name == 'event' || parent.name == 'todo') and return false end # either both duration and repeat or neither should be set [duration, repeat].compact.size == 1 and return false # attach must be single for audio actions action.downcase == 'audio' && attach.compact.size > 1 and return false super end |