Module: Status

Included in:
Action, ActionInFile, Array, Context, GTDSystem, Project, ProjectFileWriter
Defined in:
lib/status.rb

Constant Summary collapse

STATUS_ORDER =
[
:unprocessed,
:processed,
:done,
:tickled,
:delegated,
:someday,
:review                
]
ACTIVE_STATES =
[:unprocessed,:processed,:review]
INACTIVE_STATES =
[:done,:tickled,:delegated,:someday]
STATUS_SYMBOLS =
{
:unprocessed => '',
:processed => '-',
:done => '+',
:tickled=>'/',
:someday=>'!'
}
SYMBOLS_STATUS =
STATUS_SYMBOLS.invert

Instance Method Summary collapse

Instance Method Details

#activeObject



28
29
30
31
32
33
34
35
# File 'lib/status.rb', line 28

def active
  active_items = []  
  ACTIVE_STATES.each do |active_status|
    #log "Reading active status #{active_status}"

    active_items += with_status active_status
  end
  return active_items
end

#directory_name(symbol) ⇒ Object



50
51
52
# File 'lib/status.rb', line 50

def directory_name(symbol)
  symbol == :unprocessed ? '' : "@#{symbol.id2name.capitalize}/"
end

#inactiveObject



37
38
39
40
41
42
43
# File 'lib/status.rb', line 37

def inactive
  inactive_items = []  
  INACTIVE_STATES.each do |inactive_status|
    inactive_items += with_status inactive_status
  end
  return inactive_items      
end

#index(symbol) ⇒ Object



47
48
49
# File 'lib/status.rb', line 47

def index(symbol)
  STATUS_ORDER.index(symbol) || 0
end

#symbol(status) ⇒ Object



44
45
46
# File 'lib/status.rb', line 44

def symbol(status)
  STATUS_SYMBOLS[status]
end

#with_status(status) ⇒ Object

ACTIVE = 6



25
26
27
# File 'lib/status.rb', line 25

def with_status(status)
  find_all {|item| item.status == status}
end