Module: Gemmy::Patches::StringPatch::InstanceMethods::AlignLeft

Defined in:
lib/gemmy/patches/string_patch.rb

Instance Method Summary collapse

Instance Method Details

#align_left(n, sep = "\n", c = ' ') ⇒ Object

facets



247
248
249
250
251
252
253
# File 'lib/gemmy/patches/string_patch.rb', line 247

def align_left(n, sep="\n", c=' ')
  return ljust(n.to_i,c.to_s) if sep==nil
  q = split(sep.to_s).map do |line|
    line.strip.ljust(n.to_i,c.to_s)
  end
  q.join(sep.to_s)
end