Sha256: 63f0d5ed8b277851066e82e3a9d335812f6bd780f462489b65f6f1c7531c49bf
Contents?: true
Size: 1.07 KB
Versions: 2
Compression:
Stored size: 1.07 KB
Contents
module Todidnt class TodoLine IGNORE = %r{assets/js|third_?party|node_modules|jquery|Binary|vendor} attr_reader :filename, :line_number, :raw_content attr_accessor :author, :timestamp def self.all(expressions) options = [['-n']] expressions.each { |e| options << ['-e', e] } lines = [] command = GitCommand.new(:grep, options) command.execute! do |line| filename, line_number, content = line.split(/:/, 3) unless filename =~ IGNORE lines << self.new(filename, line_number.to_i, content) end end lines end def initialize(filename, line_number, raw_content) @filename = filename @line_number = line_number @raw_content = raw_content end def pretty_time Time.at(@timestamp).strftime('%F') end def content raw_content.strip[0..100] end def to_hash { :time => pretty_time, :author => author, :filename => filename, :line_number => line_number, :content => content } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
todidnt-0.4.1 | lib/todidnt/todo_line.rb |
todidnt-0.3.1 | lib/todidnt/todo_line.rb |