Skip to content

Commit

Permalink
adding copy_session method to .irbrc which takes the history of the c…
Browse files Browse the repository at this point in the history
…urrent session and copies it to the clip board
  • Loading branch information
ryanb committed Dec 7, 2009
1 parent 435ce90 commit 78c149f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions irbrc
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ def copy(str)
IO.popen('pbcopy', 'w') { |f| f << str.to_s }
end

def copy_session
history = Readline::HISTORY.entries
index = history.rindex("exit") || -1
content = history[(index+1)..-2].join("\n")
puts content
copy content
end

def paste
`pbpaste`
end
Expand Down

0 comments on commit 78c149f

Please sign in to comment.