class TaskList
Attributes
tasks[RW]
Public Class Methods
new()
click to toggle source
# File lib/todoNotifier/TaskList.rb, line 15 def initialize() self.tasks = [] f = File.open(File.expand_path("~/.todo"), "r") f.each do |l| m = parseLine(l) if m tasks << Task.new(m) end end f.close self.tasks.sort! { |a,b| a._d <=> b._d } end
Public Instance Methods
parseLine(l)
click to toggle source
# File lib/todoNotifier/TaskList.rb, line 4 def parseLine(l) # Capitals denote a title, so block them (2 or more) if l =~ /^[:upper:]+$/ return end # Matches '-', '*', '#', tabs or 2 or more spaces as the beginning of a task if l =~ /^(-|\*|\#|\t|\s{2,})(.*)/ return $2 # Return the message end end