File: comment.rb

package info (click to toggle)
ticgit 1.0.2.18-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 488 kB
  • sloc: ruby: 2,848; sh: 124; makefile: 16
file content (19 lines) | stat: -rw-r--r-- 428 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
module TicGitNG
  class Comment
    attr_accessor :base, :user, :added, :comment

    def initialize( c, user, time=nil )
      raise unless c
      @comment= c
      @user=user
      @added= time.nil? ? Time.now : time
      self
    end

    def self.read( base, file_name, sha )
      type, date, user = file_name.split('_')

      new( (base.git.gblob(sha).contents rescue nil), user, Time.at(date.to_i) )
    end
  end
end