You may have invented the wheel.
IRB_Tools and Utility_Belt, which are used to configure IRB, provide the ability to use the clipboard. Both are collections of existing gems, so I did a quick search using gem clipboard -r and came up with:
clipboard (0.9.7) win32-clipboard (0.5.2)
A look at the RubyDoc.info for the clipboard shows:
Clipboard
Access to the clipboard and do not care whether the OS is Linux, MacOS or Windows.
Using
You have Clipboard.copy,
Clipboard.paste and
Clipboard.clear
Good luck;)
EDIT: if you check the source on the linked page, for Mac you will see for copy:
def copy(data) Open3.popen3( 'pbcopy' ){ |input,_,_| input << data } paste end
and for pasta you will see:
def paste(_ = nil) `pbpaste` end
and clear is simple:
def clear copy '' end
Those who should make you point in the right direction.
the tin man
source share