Copying, pasting, and clearing the clipboard using the clipboard gem

Installation on Debian

Example

require 'clipboard'

Clipboard.copy 'fun time'

# Performed a paste operation in a text editor window and 
#   observed the text 'fun time'


# Within the text editor I copied the text 'testing' into the clipboard
Clipboard.paste #=> testing

Clipboard.clear

# Attempted to paste into the text editor window the text from
#  the clipboard, however it was empty


Resources