Class: GTDSystem
Constant Summary
Constants included
from Status
Status::ACTIVE_STATES, Status::INACTIVE_STATES, Status::STATUS_ORDER, Status::STATUS_SYMBOLS, Status::SYMBOLS_STATUS
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from Status
#active, #directory_name, #inactive, #index, #symbol, #with_status
Constructor Details
#initialize(contexts, projects) ⇒ GTDSystem
Returns a new instance of GTDSystem.
83
84
85
86
|
# File 'lib/gtd.rb', line 83
def initialize contexts, projects
@contexts = contexts
@projects = projects
end
|
Instance Attribute Details
#actions ⇒ Object
Returns the value of attribute actions.
82
83
84
|
# File 'lib/gtd.rb', line 82
def actions
@actions
end
|
#contexts ⇒ Object
Returns the value of attribute contexts.
82
83
84
|
# File 'lib/gtd.rb', line 82
def contexts
@contexts
end
|
#projects ⇒ Object
Returns the value of attribute projects.
82
83
84
|
# File 'lib/gtd.rb', line 82
def projects
@projects
end
|
Instance Method Details
#active_actions ⇒ Object
104
105
106
107
108
109
110
111
112
|
# File 'lib/gtd.rb', line 104
def active_actions
active_actions = []
active_projects = @projects.active
active_projects.each do |project|
active_actions += project.actions.active
end
active_actions
end
|
#do_process ⇒ Object
129
130
131
132
133
134
135
|
# File 'lib/gtd.rb', line 129
def do_process
process active_actions.unprocessed
unprocess inactive_actions
set_to_done done_actions
projects_to_review
empty_inbox
end
|
#done_actions ⇒ Object
154
155
156
157
158
159
160
161
|
# File 'lib/gtd.rb', line 154
def done_actions
actions = active_actions.processed.find_all do |action|
not action.context.include? action
end
actions
end
|
#empty_inbox ⇒ Object
171
172
173
174
175
176
177
178
179
180
181
182
183
184
|
# File 'lib/gtd.rb', line 171
def empty_inbox
@inbox.entries.each do |entry|
log "[Inbox]\t\t#{entry}"
unless entry[0]='@' then
project = Project.new(entry,:review)
project.infos << entry
project.set_dirty
@projects << project
else
puts "Action"
end
end
@inbox.empty!
end
|
#inactive_actions ⇒ Object
92
93
94
95
96
97
98
99
100
101
102
|
# File 'lib/gtd.rb', line 92
def inactive_actions
inactive_actions = @actions.inactive
inactive_projects = @projects.inactive
inactive_projects.each do |project|
inactive_actions += project.actions
end
inactive_actions
end
|
#process(actions) ⇒ Object
147
148
149
150
151
152
153
|
# File 'lib/gtd.rb', line 147
def process(actions)
actions.each do |action|
log "[Processed]\t#{action}"
action.status = :processed
action.context<<action
end
end
|
#projects_to_review ⇒ Object
87
88
89
90
91
|
# File 'lib/gtd.rb', line 87
def projects_to_review
projects_to_review = @projects.active.find_all {|project| project.actions.active.empty?}
projects_to_review
end
|
#set_to_done(actions) ⇒ Object
163
164
165
166
167
168
169
|
# File 'lib/gtd.rb', line 163
def set_to_done(actions)
actions.each do |action|
action.status = :done
log "[Done]\t\t#{action}"
end
end
|
#unprocess(actions) ⇒ Object
122
123
124
125
126
127
|
# File 'lib/gtd.rb', line 122
def unprocess(actions)
actions.each do |action|
action.status = :unprocessed
log "[Unprocessed]\t#{action}"
end
end
|
#unprocess_active_actions ⇒ Object
114
115
116
|
# File 'lib/gtd.rb', line 114
def unprocess_active_actions
unprocess(active_actions)
end
|
#unprocess_all_actions ⇒ Object
118
119
120
|
# File 'lib/gtd.rb', line 118
def unprocess_all_actions
unprocess(@actions)
end
|