Module: Bri::Templates::Helpers

Included in:
Match::Class, Match::Method
Defined in:
lib/bri/templates.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.hrule(text = '', width = Bri.width) ⇒ Object



78
79
80
81
82
83
84
85
86
# File 'lib/bri/templates.rb', line 78

def hrule( text = '', width = Bri.width )
  text.prepend( " " ) unless text.empty?

  rule_length = width - text.length
  rule_length = 1 if rule_length < 1

  rule = RULE_CHARACTER * rule_length
  "#{rule}#{Term::ANSIColor::bold( text )}\n"
end

.section_header(text) ⇒ Object



94
95
96
# File 'lib/bri/templates.rb', line 94

def section_header( text )
  "#{Term::ANSIColor.green}#{Term::ANSIColor.underline}#{text}#{Term::ANSIColor.reset}\n"
end

Instance Method Details



89
90
91
92
# File 'lib/bri/templates.rb', line 89

def print_origin( origin_text, width = Bri.width )
  return unless origin_text
  "(#{origin_text})".rjust( width )
end