Last active
February 2, 2021 08:57
-
-
Save amicojeko/ffd1288788473d24e5d70d51b78c0d95 to your computer and use it in GitHub Desktop.
Copy to clipboard with 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
# Windows and WSL | |
def clip_copy(input) | |
str = input.to_s | |
IO.popen('clip.exe', 'w') { |f| f << str } | |
str | |
end | |
# Mac | |
def clip_copy(input) | |
str = input.to_s | |
IO.popen('pbcopy', 'w') { |f| f << str } | |
str | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment