Class: RubyGit::Status::Parser
- Inherits:
-
Object
- Object
- RubyGit::Status::Parser
- Defined in:
- lib/ruby_git/status/parser.rb
Overview
Parses the git status porcelain v2 format output
git status --porcelain=v2 -z \ --untracked-files --ignored-files --renames \ --ahead-behind --branch --show-stash
Constant Summary collapse
- LINE_PARSER_FACTORY =
Define the parser for each line type
{ '1' => ->(line) { OrdinaryEntry.parse(line) }, '2' => ->(line) { RenamedEntry.parse(line) }, 'u' => ->(line) { UnmergedEntry.parse(line) }, '!' => ->(line) { IgnoredEntry.parse(line) }, '?' => ->(line) { UntrackedEntry.parse(line) } }.freeze
Class Method Summary collapse
-
.parse(status_output) ⇒ RubyGit::Status::Report
Parse the git status output and return a report object.
Instance Method Summary collapse
-
#initialize(status_output) ⇒ Parser
constructor
Create a new status output parser.
-
#parse ⇒ RubyGit::Status::Report
Parse the git status output.
Constructor Details
Class Method Details
.parse(status_output) ⇒ RubyGit::Status::Report
Parse the git status output and return a report object
33 34 35 |
# File 'lib/ruby_git/status/parser.rb', line 33 def self.parse(status_output) new(status_output).parse end |
Instance Method Details
#parse ⇒ RubyGit::Status::Report
Parse the git status output
61 62 63 64 65 |
# File 'lib/ruby_git/status/parser.rb', line 61 def parse process_lines(status_output_lines) Report.new(@branch, @stash, @entries) end |