Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/looped/application.rb

Instance Method Summary collapse

Instance Method Details

#truncate(length, omission: '...') ⇒ Object



246
247
248
249
250
# File 'lib/looped/application.rb', line 246

def truncate(length, omission: '...')
  return self if self.length <= length

  "#{self[0, length - omission.length]}#{omission}"
end