Class: Intent::Core::Inbox

Inherits:
Object
  • Object
show all
Defined in:
lib/intent/core.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(db_path) ⇒ Inbox

Returns a new instance of Inbox.



130
131
132
# File 'lib/intent/core.rb', line 130

def initialize(db_path)
  @list = List.new(db_path)
end

Instance Attribute Details

#listObject (readonly)

Returns the value of attribute list.



128
129
130
# File 'lib/intent/core.rb', line 128

def list
  @list
end

Instance Method Details

#add_line!(line) ⇒ Object



146
147
148
149
150
# File 'lib/intent/core.rb', line 146

def add_line!(line)
  record = Record.new("#{Date.today} #{line}")
  @list.prepend(record)
  @list.save!
end

#allObject



134
135
136
# File 'lib/intent/core.rb', line 134

def all
  @list.by_not_done
end

#focusedObject



138
139
140
# File 'lib/intent/core.rb', line 138

def focused
  @list.by_context('@focus').by_not_done
end

#focused_projectsObject



142
143
144
# File 'lib/intent/core.rb', line 142

def focused_projects
  focused.map { |t| t.projects }.flatten.uniq
end