Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/core_ext/custom_lib.rb

Overview

Custom methods for String class

Instance Method Summary collapse

Instance Method Details

#truncate(max) ⇒ Object



5
6
7
# File 'lib/core_ext/custom_lib.rb', line 5

def truncate(max)
  length > max ? "#{self[0...max]}..." : self
end