class GitCleanser::Formatter::Human

Constants

KEYS

Public Instance Methods

format(smart_thing) click to toggle source
# File lib/git_cleanser/formatter/human.rb, line 13
def format(smart_thing)
  KEYS.map do |(key, message)|
    format_message(message) + "\n" + format_list(smart_thing.public_send(key))
  end.join("\n\n")
end

Private Instance Methods

format_list(list) click to toggle source
# File lib/git_cleanser/formatter/human.rb, line 25
def format_list list
  if list.any?
    list.map { |file| Paint["  #{file}", :red] }.join("\n")
  else
    Paint["  (no files)", :green]
  end
end
format_message(message) click to toggle source
# File lib/git_cleanser/formatter/human.rb, line 21
def format_message message
  Paint[message, :magenta]
end