class Kamaze::Project::Tools::Git::Status::Decorator
Provide decoration for status
Result of “to_s“, SHOULD be similar to result obtained with:
“`sh git status -z | sed “s/x0/n/g” “`
Attributes
status[R]
@return [Kamaze::Project::Tools::Git::Status]
Public Class Methods
new(status)
click to toggle source
@param [Kamaze::Project::Tools::Git::Status] status
# File lib/kamaze/project/tools/git/status/decorator.rb, line 20 def initialize(status) @status = status end
Public Instance Methods
files()
click to toggle source
# File lib/kamaze/project/tools/git/status/decorator.rb, line 24 def files files = [status.index.to_a, status.worktree.to_a].flatten.sort_by(&:to_s) files.reject(&:untracked?) .concat(files.keep_if(&:untracked?)) end
to_s()
click to toggle source
# File lib/kamaze/project/tools/git/status/decorator.rb, line 31 def to_s files.map { |file| "#{file.status} #{file}" }.uniq.join("\n") end