class Warp::Dir::Formatter

Constants

DEFAULT_FORMAT

Attributes

store[RW]

Public Class Methods

format_point(point, *args) click to toggle source
# File lib/warp/dir/formatter.rb, line 26
def self.format_point(point, *args)
  PointFormatter.new(point).format(*args)
end
new(store) click to toggle source
# File lib/warp/dir/formatter.rb, line 12
def initialize(store)
  @store  = store
  @config = store.config
end

Public Instance Methods

format_store(*args) click to toggle source
# File lib/warp/dir/formatter.rb, line 30
def format_store(*args)
  StoreFormatter.new(store).format(*args)
end
happy(message: nil) click to toggle source
# File lib/warp/dir/formatter.rb, line 34
def happy(message: nil)
  $stdout.printf(message.blue.bold)
end
unhappy(exception: nil, message: nil) click to toggle source
# File lib/warp/dir/formatter.rb, line 17
def unhappy(exception: nil, message: nil)
  out = 'Whoops! – '.white
  out << "#{exception.message} ".red if exception && !message
  out << "#{message} ".red if !exception && message
  out << "#{exception.message}:\n#{message}".red if message && exception
  out << "\n"
  print ? $stderr.printf(out) : out
end