Advertisement
m_antis

Kool London Chat

Mar 23rd, 2020
355
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.27 KB | None | 0 0
  1. def to_clipboard(text)
  2.   string = text.to_s
  3.   IO.popen('pbcopy', 'w') {|t| t << text}
  4.   string
  5. end
  6.  
  7. print "Enter message: "
  8. text = gets.chomp!
  9. text = text.chars.map { |m| m == ' ' ? '|' : ":#{m}:" }.join(' ')
  10.  
  11. # verify expected format
  12. puts text
  13.  
  14. to_clipboard(text)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement