Class: Toodledo::Priority

Inherits:
Object
  • Object
show all
Defined in:
lib/toodledo/priority.rb

Overview

A priority enum.

TODO Refactor using symbols?

Constant Summary collapse

NEGATIVE =
-1
LOW =
0
MEDIUM =
1
HIGH =
2
TOP =
3
PRIORITY_ARRAY =
[ TOP, HIGH, MEDIUM, LOW, NEGATIVE ]

Class Method Summary collapse

Class Method Details

.eachObject



21
22
23
# File 'lib/toodledo/priority.rb', line 21

def self.each
  PRIORITY_ARRAY.each{|value| yield(value)}
end

.valid?(input) ⇒ Boolean

Returns:

  • (Boolean)


25
26
27
28
29
30
31
32
# File 'lib/toodledo/priority.rb', line 25

def self.valid?(input)
  for priority in PRIORITY_ARRAY
    if input == priority
      return true
    end        
  end
  return false
end