Module: NoteFormatter

Defined in:
lib/note_formatter.rb,
lib/note_formatter/note.rb,
lib/note_formatter/formatter.rb

Defined Under Namespace

Classes: Formatter, Note

Class Method Summary collapse

Class Method Details

.test(options) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/note_formatter.rb', line 8

def self.test(options)

  f = File.open(options[:note_path], "r")

  a = f.readlines

  notes = []
  note = nil

  a.each do |line|
    if line[0] == "!"
      notes << note if note
      note = Note.new line.gsub(/[!\n]/,"")
    elsif (line[0] =~ /[*>]/) && note
      task = ({ line.gsub(/[*>\n]/,"") => line[0] })
      note.tasks.merge!(task)
    elsif (line[0] == "$")
      notes << note if note
    end
  end

  notes.each { |n| Formatter.new("ata_tcc", n).format_file }
end