irb time saver
add to ~/.irbrc:
def copy(*args) IO.popen('pbcopy', 'r+') { |clipboard| clipboard.puts args.map(&:inspect) }; end
and then in irb:
copy [1,2,3,4]
"[1, 2, 3, 4]" is now in your clipboard.
Written by Tieg Zaharia
Related protips
4 Responses
Pry has something like this built-in, but slightly more comprehensive, let me know what you think:
over 1 year ago
·
thx @banister! I haven't tried it out yet, but I might give it a shot now
over 1 year ago
·
irbtools also includes a copy method: https://github.com/janlelis/irbtools/blob/master/lib/irbtools/libraries.rb#L198
over 1 year ago
·
This is great!
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#