Class: CommitFormat::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/commit_format/parser.rb

Constant Summary collapse

SEPARATOR =
"# ------------------------ COMMIT >! ------------------------"

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Parser

Returns a new instance of Parser.



7
8
9
# File 'lib/commit_format/parser.rb', line 7

def initialize(options)
  @options = options
end

Instance Method Details

#commitsObject



11
12
13
14
15
16
17
18
# File 'lib/commit_format/parser.rb', line 11

def commits
  log_output =
    `git log --reverse --pretty="#{SEPARATOR}%n%B" #{arguments(@options)}`
  log_output
    .split(SEPARATOR)
    .map(&:strip)
    .reject { |commit| commit.length.zero? }
end