Module: Vpim::Icalendar::Property::Priority

Included in:
Vevent, Vtodo
Defined in:
lib/vpim/property/priority.rb

Instance Method Summary collapse

Instance Method Details

#priorityObject

priority is a number from 1 to 9, with 1 being the highest priority, 9 being the lowest. 0 means “no priority”, equivalent to not specifying the PRIORITY field.

The other integer values are reserved by RFC2445.

TODO

  • methods to compare priorities?

  • return as class Priority, with #to_i, and #to_s, and appropriate comparison operators?



25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/vpim/property/priority.rb', line 25

def priority
  p = @properties.detect { |f| f.name? 'PRIORITY' }

  if !p
    p = 0
  else
    p = p.value.to_i

    if( p < 0 || p > 9 )
      raise Vpim::InvalidEncodingError, 'Invalid priority #{@priority} - it must be 0-9!'
    end
  end
  p
end