Class: BBNW::Commit

Inherits:
Object
  • Object
show all
Defined in:
lib/adapters/base/commit.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(commit_id, message, committer, timestamp, total_changes = 0) ⇒ Commit

Returns a new instance of Commit.



7
8
9
10
11
12
13
# File 'lib/adapters/base/commit.rb', line 7

def initialize(commit_id, message, committer, timestamp, total_changes = 0)
  @commit_id     = commit_id
  @message       = message
  @committer     = committer
  @timestamp     = timestamp.is_a?(String) ? Time.parse(timestamp) : timestamp
  @total_changes = total_changes
end

Instance Attribute Details

#commit_idObject (readonly)

Returns the value of attribute commit_id.



5
6
7
# File 'lib/adapters/base/commit.rb', line 5

def commit_id
  @commit_id
end

#committerObject (readonly)

Returns the value of attribute committer.



5
6
7
# File 'lib/adapters/base/commit.rb', line 5

def committer
  @committer
end

#messageObject (readonly)

Returns the value of attribute message.



5
6
7
# File 'lib/adapters/base/commit.rb', line 5

def message
  @message
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



5
6
7
# File 'lib/adapters/base/commit.rb', line 5

def timestamp
  @timestamp
end

#total_changesObject (readonly)

Returns the value of attribute total_changes.



5
6
7
# File 'lib/adapters/base/commit.rb', line 5

def total_changes
  @total_changes
end

Instance Method Details

#activityObject



21
22
23
# File 'lib/adapters/base/commit.rb', line 21

def activity
  @message
end

#end_timeObject



18
19
20
# File 'lib/adapters/base/commit.rb', line 18

def end_time
  @timestamp
end

#start_timeObject



15
16
17
# File 'lib/adapters/base/commit.rb', line 15

def start_time
  @timestamp
end

#task_idObject

Looks for an integer > 5 chars as the task_id



25
26
27
28
29
30
# File 'lib/adapters/base/commit.rb', line 25

def task_id
  if message =~ /(\d{6,})/
    return $1.to_i
  end
  nil
end