Created
April 29, 2016 17:39
-
-
Save jaredatron/935221f69dbd9ae439450a66b8b3b7d0 to your computer and use it in GitHub Desktop.
copy and paste in ruby console
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
class String | |
def copy | |
IO.popen('pbcopy', 'r+'){|c| c.print(self) } | |
puts 'copied' | |
self | |
end | |
end | |
def self.copy(*args) | |
IO.popen('pbcopy', 'r+'){|c| c.print(*args) } | |
puts 'coppied' | |
end | |
def self.paste | |
`pbpaste`.chomp | |
end | |
def self.eval_clipboard | |
eval(paste) | |
end | |
# Clear the screen | |
def self.clear | |
system 'clear' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment