Class: GitPlus::Parsers::Commits::Unsaved::History

Inherits:
Object
  • Object
show all
Defined in:
lib/git_plus/parsers/commits/unsaved/history.rb

Overview

Parses unsaved commit history into commit objects.

Instance Method Summary collapse

Constructor Details

#initialize(entry: Entry) ⇒ History

Returns a new instance of History.



9
10
11
# File 'lib/git_plus/parsers/commits/unsaved/history.rb', line 9

def initialize entry: Entry
  @entry = entry
end

Instance Method Details

#call(path) ⇒ Object



13
14
15
16
17
# File 'lib/git_plus/parsers/commits/unsaved/history.rb', line 13

def call path
  fail Error, %(Invalid commit message path: "#{path}".) unless path.exist?

  path.read.scrub("?").then { |message| entry.call message }
end