Skip to content

Commit

Permalink
added copy + paste to irb
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Ström committed Sep 1, 2009
1 parent 78a92ac commit 6336292
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion irbrc
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,17 @@ end

load File.dirname(__FILE__) + '/.railsrc' if $0 == 'irb' && ENV['RAILS_ENV']

alias :x :exit
alias :x :exit

# http://judofyr.net/posts/copy-paste-irb.html
def copy(str)
IO.popen('pbcopy', 'w') { |f| f << str.to_s }
end

def paste
`pbpaste`
end

def ep
eval(paste)
end

0 comments on commit 6336292

Please sign in to comment.