1
0
Fork 0
mirror of https://github.com/neocities/neocities.git synced 2025-05-15 08:57:17 +02:00
neocities/ext/string.rb
2014-07-03 14:03:35 -05:00

14 lines
238 B
Ruby

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