class TodoAgent::Parsers::Ruby

Public Class Methods

parse(file) click to toggle source
# File lib/todo_agent/parsers/ruby.rb, line 10
def self.parse(file)
  regex_str = TodoAgent::Parsers::RegexBuilder.regex
  regexp = Regexp.new("^\\s*##{regex_str}$", "mig")
  comments = []

  # TODO: This logic belongs out of the specific ruby parser
  # This only matches single line.
  IO.foreach(file) do |line|
    match = regexp.match(line)
    comments << TodoAgent::Comment.new(match, file, $INPUT_LINE_NUMBER) if match
  end

  comments
end