Class: Warp::Dir::Formatter
Defined Under Namespace
Classes: PointFormatter, StoreFormatter
Constant Summary
collapse
- DEFAULT_FORMAT =
:ascii
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(store) ⇒ Formatter
Returns a new instance of Formatter.
12
13
14
15
|
# File 'lib/warp/dir/formatter.rb', line 12
def initialize(store)
@store = store
@config = store.config
end
|
Instance Attribute Details
Returns the value of attribute store.
10
11
12
|
# File 'lib/warp/dir/formatter.rb', line 10
def store
@store
end
|
Class Method Details
26
27
28
|
# File 'lib/warp/dir/formatter.rb', line 26
def self.format_point(point, *args)
PointFormatter.new(point).format(*args)
end
|
Instance Method Details
30
31
32
|
# File 'lib/warp/dir/formatter.rb', line 30
def format_store(*args)
StoreFormatter.new(store).format(*args)
end
|
#happy(message: nil) ⇒ Object
34
35
36
|
# File 'lib/warp/dir/formatter.rb', line 34
def happy(message: nil)
$stdout.printf(message.blue.bold)
end
|
#unhappy(exception: nil, message: nil) ⇒ Object
17
18
19
20
21
22
23
24
|
# 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
|