mirror of
https://github.com/neocities/neocities.git
synced 2025-05-15 00:47:16 +02:00
shorten titles, DRY up url generation
This commit is contained in:
parent
c512b579ce
commit
50d0e9d4db
9 changed files with 66 additions and 31 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue