2013-04-01 08:03:20 +11:00
|
|
|
require 'irb/ext/save-history'
|
|
|
|
require 'irb/completion'
|
|
|
|
|
2019-07-22 16:21:32 +10:00
|
|
|
ARGV.concat %w[--readline --prompt-mode simple]
|
2013-04-01 08:03:20 +11:00
|
|
|
|
|
|
|
IRB.conf[:SAVE_HISTORY] = 1000
|
|
|
|
IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb-save-history"
|
|
|
|
|
2008-10-09 12:51:52 +11:00
|
|
|
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
|
2009-06-10 13:02:44 +10:00
|
|
|
end
|
2019-07-22 16:21:32 +10:00
|
|
|
|
|
|
|
require 'rubygems'
|
|
|
|
begin
|
|
|
|
require 'pry'
|
|
|
|
Pry.start
|
|
|
|
exit
|
|
|
|
rescue LoadError
|
|
|
|
if defined?(::Bundler)
|
|
|
|
pry_specs = ENV['GEM_PATH'].split(':').
|
|
|
|
flat_map { |path| Dir.glob("#{path}/specifications/pry-*.gemspec") }.
|
|
|
|
flat_map { |path| Gem::Specification.load(path) }
|
|
|
|
|
|
|
|
pry_specs = pry_specs.
|
|
|
|
reverse_sort_by(&:version).
|
|
|
|
uniq_by(&:name)
|
|
|
|
|
|
|
|
pry_specs.each do |spec|
|
|
|
|
$LOAD_PATH << spec.lib_dirs_glob
|
|
|
|
end
|
|
|
|
|
|
|
|
begin
|
|
|
|
require 'pry'
|
|
|
|
Pry.start
|
|
|
|
exit
|
|
|
|
rescue LoadError => e
|
|
|
|
puts e
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|