Sha256: cc13bc954bc3674c20e4dab7172d3c9e8392349826995081059b4e5058addc23

Contents?: true

Size: 1.09 KB

Versions: 1

Compression:

Stored size: 1.09 KB

Contents

module TodosExport
  class StdOut
    attr_accessor :main

    def initialize(main)
      @main = main
    end

    def run
      process_exportables
    end

    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

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
todos_export-0.4.0 lib/todos_export/std_out.rb