shorten titles, DRY up url generation

This commit is contained in:
Kyle Drake 2014-07-03 14:03:35 -05:00
parent c512b579ce
commit 50d0e9d4db
9 changed files with 66 additions and 31 deletions

View file

@ -2,4 +2,13 @@ class String
def empty?
strip == '' ? true : false
end
def shorten(length, usedots=true)
if usedots
return self if self.length < length
"#{self[0..length-3]}..."
else
self[0..length]
end
end
end