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.



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

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

Instance Attribute Details

#listObject (readonly)

Returns the value of attribute list.



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

def list
  @list
end

Instance Method Details

#add_line!(line) ⇒ Object



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

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

#allObject



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

def all
  @list.by_not_done
end

#focusedObject



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

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

#focused_projectsObject



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

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