Class: PVN::Status::Formatter
- Inherits:
-
ColorFormatter
- Object
- ColorFormatter
- PVN::Status::Formatter
- Defined in:
- lib/pvn/status/formatter/status_formatter.rb
Overview
a format for status entries
Direct Known Subclasses
Constant Summary collapse
- COLORS =
{ :added => [ :green ], :modified => [ :yellow ], :deleted => [ :red ], :renamed => [ :magenta ], }
Instance Attribute Summary collapse
-
#use_colors ⇒ Object
readonly
Returns the value of attribute use_colors.
Instance Method Summary collapse
- #colors(field) ⇒ Object
-
#initialize(use_colors) ⇒ Formatter
constructor
A new instance of Formatter.
Methods inherited from ColorFormatter
Constructor Details
#initialize(use_colors) ⇒ Formatter
Returns a new instance of Formatter.
22 23 24 25 |
# File 'lib/pvn/status/formatter/status_formatter.rb', line 22 def initialize use_colors # should also turn this off if not on a terminal that supports colors ... @use_colors = use_colors end |
Instance Attribute Details
#use_colors ⇒ Object (readonly)
Returns the value of attribute use_colors.
20 21 22 |
# File 'lib/pvn/status/formatter/status_formatter.rb', line 20 def use_colors @use_colors end |
Instance Method Details
#colors(field) ⇒ Object
27 28 29 |
# File 'lib/pvn/status/formatter/status_formatter.rb', line 27 def colors field use_colors ? COLORS[field] : nil end |