Class: TodosExport::StdOut

Inherits:
Object
  • Object
show all
Defined in:
lib/todos_export/std_out.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(main) ⇒ StdOut

Returns a new instance of StdOut.



5
6
7
# File 'lib/todos_export/std_out.rb', line 5

def initialize(main)
  @main = main
end

Instance Attribute Details

#mainObject

Returns the value of attribute main.



3
4
5
# File 'lib/todos_export/std_out.rb', line 3

def main
  @main
end

Instance Method Details

#outputObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/todos_export/std_out.rb', line 13

def output
  out = ''
  todos = self.main.exportable_todos

  if todos.size > 0
    out = "Todos\n====="
    todos.each do |ex|
      out += "\n- #{ex[:content]}"
      out += "\n  <%= color(\"#{ex[:original_file]}:#{ex[:line]}\", :green) %>"
    end
  end

  fixmes = self.main.exportable_fixmes

  if fixmes.size > 0
    out += "\n\nFixmes\n======"
    fixmes.each do |ex|
      out += "\n- #{ex[:content]}"
      out += "\n  <%= color(\"#{ex[:original_file]}:#{ex[:line]}\", :green) %>"
    end
  end

  bugs = self.main.exportable_bugs

  if bugs.size > 0
    out += "\n\nBugs\n===="
    bugs.each do |ex|
      out += "\n- #{ex[:content]}"
      out += "\n  <%= color(\"#{ex[:original_file]}:#{ex[:line]}\", :green) %>"
    end
  end

  return out
end

#process_exportablesObject



48
49
50
51
# File 'lib/todos_export/std_out.rb', line 48

def process_exportables
  say("\n")
  say(self.output)
end

#runObject



9
10
11
# File 'lib/todos_export/std_out.rb', line 9

def run
  process_exportables
end