Class: PVN::Status::EntryFormatter

Inherits:
Formatter show all
Defined in:
lib/pvn/status/formatter/entry_formatter.rb

Constant Summary

Constants inherited from Formatter

Formatter::COLORS

Instance Attribute Summary collapse

Attributes inherited from Formatter

#use_colors

Instance Method Summary collapse

Methods inherited from Formatter

#colors

Methods inherited from ColorFormatter

#add_field, #colorize, #pad

Constructor Details

#initialize(use_colors, entry) ⇒ EntryFormatter

Returns a new instance of EntryFormatter.



12
13
14
15
# File 'lib/pvn/status/formatter/entry_formatter.rb', line 12

def initialize use_colors, entry
  super use_colors
  @entry = entry
end

Instance Attribute Details

#entryObject (readonly)

Returns the value of attribute entry.



10
11
12
# File 'lib/pvn/status/formatter/entry_formatter.rb', line 10

def entry
  @entry
end

Instance Method Details

#formatObject



17
18
19
20
21
22
23
24
25
# File 'lib/pvn/status/formatter/entry_formatter.rb', line 17

def format
  lines = Array.new
  lines << if use_colors
             "    " + colorize(entry.path, entry.status.type)
           else
             "#{entry.status.type.to_s[0 .. 0].upcase}   #{entry.path}"
           end
  lines
end