Skip to content

Instantly share code, notes, and snippets.

@ys
Created December 13, 2013 15:10
Show Gist options
  • Save ys/7945659 to your computer and use it in GitHub Desktop.
Save ys/7945659 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
def padded_tweet(message)
if message.size >= 140
return message[0..139]
end
dup = message.dup
if %w{. ! ? …}.include? message[-1]
return dup.ljust(140, message[-1])
end
return dup.ljust(140, '!')
end
puts padded_tweet(ARGV.first)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment