Class: TicGitNG::Comment

Inherits:
Object
  • Object
show all
Defined in:
lib/ticgit-ng/comment.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(c, user, time = nil) ⇒ Comment

Returns a new instance of Comment.



5
6
7
8
9
10
11
# File 'lib/ticgit-ng/comment.rb', line 5

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

Instance Attribute Details

#addedObject

Returns the value of attribute added.



3
4
5
# File 'lib/ticgit-ng/comment.rb', line 3

def added
  @added
end

#baseObject

Returns the value of attribute base.



3
4
5
# File 'lib/ticgit-ng/comment.rb', line 3

def base
  @base
end

#commentObject

Returns the value of attribute comment.



3
4
5
# File 'lib/ticgit-ng/comment.rb', line 3

def comment
  @comment
end

#userObject

Returns the value of attribute user.



3
4
5
# File 'lib/ticgit-ng/comment.rb', line 3

def user
  @user
end

Class Method Details

.read(base, file_name, sha) ⇒ Object



13
14
15
16
17
# File 'lib/ticgit-ng/comment.rb', line 13

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