Skip to content

Instantly share code, notes, and snippets.

@athap
Created March 19, 2014 01:01
Show Gist options
  • Save athap/9633491 to your computer and use it in GitHub Desktop.
Save athap/9633491 to your computer and use it in GitHub Desktop.
Truncate text in Ruby
MaxLength = N
valid_string = some_long_text[0,N] if some_long_text.length > N
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment