Class: GitPrettyAccept::MergeCommand
- Inherits:
-
Object
- Object
- GitPrettyAccept::MergeCommand
- Defined in:
- lib/git_pretty_accept/merge_command.rb
Constant Summary collapse
- MESSAGE_TEMPLATE_FILENAME =
'.git-pretty-accept-template.txt'
Instance Attribute Summary collapse
-
#branch ⇒ Object
readonly
Returns the value of attribute branch.
-
#let_user_edit_message ⇒ Object
readonly
Returns the value of attribute let_user_edit_message.
Instance Method Summary collapse
-
#initialize(branch, let_user_edit_message) ⇒ MergeCommand
constructor
A new instance of MergeCommand.
- #merge_message ⇒ Object
- #merge_message_with_escaped_single_quote ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(branch, let_user_edit_message) ⇒ MergeCommand
Returns a new instance of MergeCommand.
7 8 9 10 |
# File 'lib/git_pretty_accept/merge_command.rb', line 7 def initialize(branch, ) @branch = branch @let_user_edit_message = end |
Instance Attribute Details
#branch ⇒ Object (readonly)
Returns the value of attribute branch.
5 6 7 |
# File 'lib/git_pretty_accept/merge_command.rb', line 5 def branch @branch end |
#let_user_edit_message ⇒ Object (readonly)
Returns the value of attribute let_user_edit_message.
5 6 7 |
# File 'lib/git_pretty_accept/merge_command.rb', line 5 def @let_user_edit_message end |
Instance Method Details
#merge_message ⇒ Object
12 13 14 15 16 |
# File 'lib/git_pretty_accept/merge_command.rb', line 12 def if File.exists?(MESSAGE_TEMPLATE_FILENAME) File.read(MESSAGE_TEMPLATE_FILENAME) end end |
#merge_message_with_escaped_single_quote ⇒ Object
19 20 21 |
# File 'lib/git_pretty_accept/merge_command.rb', line 19 def .gsub("'") { %q{'\''} } end |
#to_s ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/git_pretty_accept/merge_command.rb', line 23 def to_s [ "git merge", "--no-ff", ? '--edit' : '--no-edit', branch, && "--message '#{}'" ].join(' ') end |