Class: Git::BlameColor::Commit

Inherits:
Object
  • Object
show all
Defined in:
lib/git-blame-color/commit.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(block) ⇒ Commit

Returns a new instance of Commit.



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/git-blame-color/commit.rb', line 9

def initialize(block)
  @hash = block[0].split(' ')[0]
  @line_number = block[0].split(' ')[2].to_i
  @author = find_key(block, 'author').value
  @email = find_key(block, 'author-mail').value.gsub(/[<>]/, '')
  @timestamp = find_key(block, 'author-time').value.to_i
  @timezone = find_key(block, 'author-tz').value
  @summary = find_key(block, 'summary').value
  @edited_line = block.last.gsub(/^\t/, '')
  @is_boundary = !find_key(block, 'boundary').nil?
end

Instance Attribute Details

#authorObject (readonly)

Returns the value of attribute author.



7
8
9
# File 'lib/git-blame-color/commit.rb', line 7

def author
  @author
end

#edited_lineObject (readonly)

Returns the value of attribute edited_line.



7
8
9
# File 'lib/git-blame-color/commit.rb', line 7

def edited_line
  @edited_line
end

#emailObject (readonly)

Returns the value of attribute email.



7
8
9
# File 'lib/git-blame-color/commit.rb', line 7

def email
  @email
end

#hashObject (readonly)

Returns the value of attribute hash.



7
8
9
# File 'lib/git-blame-color/commit.rb', line 7

def hash
  @hash
end

#line_numberObject (readonly)

Returns the value of attribute line_number.



7
8
9
# File 'lib/git-blame-color/commit.rb', line 7

def line_number
  @line_number
end

#summaryObject (readonly)

Returns the value of attribute summary.



7
8
9
# File 'lib/git-blame-color/commit.rb', line 7

def summary
  @summary
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



7
8
9
# File 'lib/git-blame-color/commit.rb', line 7

def timestamp
  @timestamp
end

#timezoneObject (readonly)

Returns the value of attribute timezone.



7
8
9
# File 'lib/git-blame-color/commit.rb', line 7

def timezone
  @timezone
end

Instance Method Details

#boundary?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/git-blame-color/commit.rb', line 21

def boundary?
  @is_boundary
end