Skip to content

Instantly share code, notes, and snippets.

@olly
Created February 10, 2013 22:45
Embed
What would you like to do?
A simple addition to access Mac OS X's pbcopy & pbpaste commands from IRB.
module Clipboard
def pbcopy(data)
IO.popen('pbcopy', 'w') {|io| io.write(data)}
end
def pbpaste
IO.popen('pbpaste', 'r').read
end
end
include Clipboard
>> pbcopy "Test"
=> 4
>> pbpaste
=> "Test"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment