lib/string_ext.rb
# Pad a string with extra "X" characters (by default) to make it up to a
# multiple of 5 characters wide, in total.
Pad a string with extra "X" characters (by default) to make it up to a
multiple of 5 characters wide, in total.
Pad a string with extra " X " characters ( by default ) to make it up to a multiple of 5 characters wide in total .
def pad(block_size = 5, pad_character = "X")
      pad_chars = block_size - length % block_size
      if pad_chars == block_size
        self
      else
        self + (pad_character * pad_chars)
      end
    end
def pad ( block_size = 5 , pad_character = "X" ) pad_chars = block_size - length % block_size if pad_chars == block_size self else self + ( pad_character * pad_chars ) end end
Pad a string with extra "X" characters (by default) to make it up to a
multiple of 5 characters wide, in total.
Pad a string with extra " X " characters ( by default ) to make it up to a multiple of 5 characters wide in total .
block_size
<not_specific>
pad_character
<not_specific>