Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 41 lines (33 sloc) 1.041 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
unless RUBY_ENGINE == 'macruby'
  require 'irb/completion'

  require 'irb/ext/save-history'
  ARGV.concat [ "--readline", "--prompt-mode", "simple" ]

  IRB.conf[:HISTORY_FILE] = File.expand_path('~/.irb_history')
  IRB.conf[:SAVE_HISTORY] = 1000
  IRB.conf[:PROMPT_MODE] = :SIMPLE
  IRB.conf[:AUTO_INDENT] = true

  require 'rubygems'
  require 'awesome_print'

  require 'brice/init' unless ENV.has_key? 'ZEUS_MASTER_FD'

  class Object
    # Return a list of methods defined locally for a particular object. Useful
    # for seeing what it does whilst losing all the guff that's implemented
    # by its parents (eg Object).
    def local_methods(obj = self)
      (obj.methods - obj.class.superclass.instance_methods).sort
    end
  end

  def copy(str)
    IO.popen('pbcopy', 'w') { |f| f << str.to_s }
  end

  def copy_history
    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
end
Something went wrong with that request. Please try again.