Sha256: 49a7bcacad85e7c02c92daeed601898996c4b3d653769aa864364ac3648a1d71

Contents?: true

Size: 709 Bytes

Versions: 8

Compression:

Stored size: 709 Bytes

Contents

module Toadie
  class Todo
    attr_accessor :file, :line, :text, :blame

    def initialize(file, line, text)
      self.file  = file
      self.line  = line
      self.text  = text.to_s.sub(/#\s*TODO/, '').strip
      self.blame = Blame.new(file, line)
      @reassignment = find_reassignment
    end

    def to_s
      text.nil? || text.empty? ? '<no content>' : text
    end

    def reassigned?
      !!@reassignment
    end

    def responsible
      @reassignment || blame.author
    end

    def author
      blame.author
    end

    private

    def find_reassignment
      Author.all.find do |author|
        author.nicknames.any? { |nickname| text.include?(nickname) }
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
toadie-0.0.8 lib/toadie/todo.rb
toadie-0.0.7 lib/toadie/todo.rb
toadie-0.0.6 lib/toadie/todo.rb
toadie-0.0.5 lib/toadie/todo.rb
toadie-0.0.4 lib/toadie/todo.rb
toadie-0.0.3 lib/toadie/todo.rb
toadie-0.0.2 lib/toadie/todo.rb
toadie-0.0.1 lib/toadie/todo.rb