Method: YARD::Templates::Helpers::TextHelper#align_right

Defined in:
lib/yard/templates/helpers/text_helper.rb

#align_right(text, spacer = ' ', col = 72) ⇒ String

Returns aligns text to the right.

Returns:

  • (String)

    aligns text to the right

[View source]

37
38
39
40
# File 'lib/yard/templates/helpers/text_helper.rb', line 37

def align_right(text, spacer = ' ', col = 72)
  text = text[0, col - 4] + '...' if (col - 1 - text.length) < 0
  spacer * (col - 1 - text.length) + " " + text
end