Method: Doing::Completion::StringUtils#ltrunc

Defined in:
lib/doing/completion/completion_string.rb

#ltrunc(max) ⇒ Object

Truncate string from left



19
20
21
22
23
24
25
# File 'lib/doing/completion/completion_string.rb', line 19

def ltrunc(max)
  if length > max
    sub(/^.*?(.{#{max - 3}})$/, '...\1')
  else
    self
  end
end