Class: Prettytodo::NotesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/prettytodo/notes_controller.rb

Defined Under Namespace

Classes: PrettyTodoStruct

Instance Method Summary collapse

Instance Method Details

#indexObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/prettytodo/notes_controller.rb', line 3

def index
  annotations = Rails::SourceAnnotationExtractor.new(
    Rails::SourceAnnotationExtractor::Annotation.tags.join("|")
  ).find(
    Rails::SourceAnnotationExtractor::Annotation.directories
  )
  pretty_annotations = []
  annotations.keys.each do |file_name|
    annotations[file_name].each do |todo|
    pretty_annotations << PrettyTodoStruct.new(
      todo.tag, todo.text, todo.line, file_name
    )
    end
  end
  @annotations_by_tag = pretty_annotations.group_by(&:tag)
end