Method: CommandLineInterface#first
- Defined in:
- lib/thartmx.rb
#first ⇒ Object
226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 |
# File 'lib/thartmx.rb', line 226 def first t = Array.new tasks = @rtm.tasksAllTaskList tasks.each do |key,val| val.each do |k,v| t.push(v) unless v.complete? # do not add c ompleted tasks end end # sorting by date (inverse order) and than by task name t.sort! do |a,b| if (a.has_due? and b.has_due?) a.due <=> b.due elsif a.has_due? -1 elsif b.has_due? 1 else a[:name] <=> b[:name] end end # compose string result s = '' tt = t[0] s += tt[:name].to_s + " -- " + tt.due.to_s + "\n" puts s end |