Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/sdoc_all/core_extensions.rb

Instance Method Summary collapse

Instance Method Details

#shrink(max_length) ⇒ Object



24
25
26
27
28
29
30
# File 'lib/sdoc_all/core_extensions.rb', line 24

def shrink(max_length)
  if length > max_length
    "#{self[0, max_length - 1]}"
  else
    self
  end
end