Created
October 27, 2018 20:54
-
-
Save ibanez270dx/fa60c6e647d0425123149dae5af92aaa to your computer and use it in GitHub Desktop.
Add pbcopy to pry
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
# Copy and paste sourced from: https://coderwall.com/p/qp2aha/ruby-pbcopy-and-pbpaste | |
def pbcopy(input) | |
str = input.to_s | |
IO.popen('pbcopy', 'w') { |f| f << str } | |
puts "copied to clipboard" | |
true | |
rescue | |
puts $! | |
end | |
def pbpaste | |
`pbpaste` | |
end | |
Pry::Commands.block_command 'paste_eval', "Pastes from the clipboard then evals it in the context of Pry" do | |
_pry_.input = StringIO.new(pbpaste) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment