Module: Relevance::CoreExtensions::String

Included in:
String
Defined in:
lib/relevance/core_extensions/ellipsize.rb

Instance Method Summary collapse

Instance Method Details

#ellipsize(cutoff = 20) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/relevance/core_extensions/ellipsize.rb', line 8

def ellipsize(cutoff = 20)
  if length > cutoff
    "#{self[0...cutoff]}..."
  else
    self
  end
end