Skip to content

Instantly share code, notes, and snippets.

@ys
Created December 13, 2013 15:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ys/7945672 to your computer and use it in GitHub Desktop.
Save ys/7945672 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
if %w{. ! ? …}.include? message[-1]
return message.ljust(140, message[-1])
end
return message.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