Instantly share code, notes, and snippets.

@olly /irbrc.rb
Created Feb 10, 2013

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