Class: Clive::Formatter::Colour

Inherits:
Plain show all
Defined in:
lib/clive/formatter/colour.rb

Constant Summary

Constants inherited from Plain

Plain::DEFAULTS

Instance Attribute Summary

Attributes inherited from Clive::Formatter

#commands, #footer, #header, #options

Instance Method Summary collapse

Methods inherited from Plain

#initialize, #to_s

Methods inherited from Clive::Formatter

#initialize, #inspect, #to_s

Constructor Details

This class inherits a constructor from Clive::Formatter::Plain

Instance Method Details

#after_for(opt) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/clive/formatter/colour.rb', line 6

def after_for(opt)
  r = ""
  after = description_for(opt).dup << " " << choices_for(opt)
  unless after == " "
    r << "# ".grey << Output.wrap_text(after,
                                       left_width + padding(2).size,
                                       @opts[:width])
  end
  r
end

#choices_for(opt) ⇒ Object



26
27
28
29
30
31
32
33
# File 'lib/clive/formatter/colour.rb', line 26

def choices_for(opt)
  s = super
  if s.empty?
    s
  else
    s.blue.bold
  end
end

#description_for(opt) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/clive/formatter/colour.rb', line 17

def description_for(opt)
  s = super
  if s.empty?
    s
  else
    s.grey
  end
end