Class: RuboBot::Git::CommitMessage

Inherits:
Object
  • Object
show all
Defined in:
lib/rubobot/git/commit_message.rb

Overview

A Git commit message

Instance Method Summary collapse

Constructor Details

#initialize(cop, command, stdout) ⇒ CommitMessage

Returns a new instance of CommitMessage.



7
8
9
10
11
# File 'lib/rubobot/git/commit_message.rb', line 7

def initialize(cop, command, stdout)
  @cop = cop
  @command = command
  @stdout = stdout
end

Instance Method Details

#==(other) ⇒ Object



33
34
35
# File 'lib/rubobot/git/commit_message.rb', line 33

def ==(other)
  to_h == other.to_h
end

#bodyObject



17
18
19
20
21
22
23
# File 'lib/rubobot/git/commit_message.rb', line 17

def body
  <<~MSG
    #{command}

    #{stdout}
  MSG
end

#subjectObject



13
14
15
# File 'lib/rubobot/git/commit_message.rb', line 13

def subject
  "Auto-correct #{cop}"
end

#to_sObject



25
26
27
28
29
30
31
# File 'lib/rubobot/git/commit_message.rb', line 25

def to_s
  <<~MSG.chomp
    #{subject}

    #{body}
  MSG
end