Sha256: 69907695f47ee40c3f9bd415e6136e45f0fd191101c3f910004f0f5294b0469e
Contents?: true
Size: 1.06 KB
Versions: 1
Compression:
Stored size: 1.06 KB
Contents
module GitWrapper module Results class StatusPorcelain attr_reader :file_name attr_reader :original_file_name attr_reader :status attr_reader :staged_for_commit def initialize(file_name, original_file_name, status, staged_for_commit) @file_name = file_name @original_file_name = original_file_name @status = status @staged_for_commit = staged_for_commit end def self.parse(text) StatusPorcelain.new parse_file_name(text), parse_original_file_name(text), parse_status(text), parse_staged_for_commit(text) end private def self.parse_file_name(text) text[3..text.length].gsub("\"", "").split(' -> ').last end def self.parse_original_file_name(text) text[3..text.length].gsub("\"", "").split(' -> ').first end def self.parse_status(text) FileStatus.value_of text[0..2].strip[0] end def self.parse_staged_for_commit(text) text[1..2].strip.empty? end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
git_wrapper-1.0.0 | lib/git_wrapper/results/status_porcelain.rb |