Created
March 15, 2016 19:06
-
-
Save mohnish/89cf5e7526725d2dacc9 to your computer and use it in GitHub Desktop.
clipboard interface for ruby
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# (c) https://github.com/janlelis/clipboard/blob/master/lib/clipboard/mac.rb | |
require 'open3' | |
module Clipboard | |
extend self | |
def paste(_ = nil) | |
`pbpaste` | |
end | |
def copy(data) | |
Open3.popen3( 'pbcopy' ){ |input,_,_| input << data } | |
paste | |
end | |
def clear | |
copy '' | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment