class Icalendar::Alarm

Public Class Methods

new() click to toggle source
Calls superclass method
# File lib/icalendar/alarm.rb, line 23
def initialize
  super 'alarm'
  self.action = 'DISPLAY'
end

Public Instance Methods

valid?(strict = false) click to toggle source
Calls superclass method
# File lib/icalendar/alarm.rb, line 28
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