forked from zorab47/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathirbrc
35 lines (31 loc) · 924 Bytes
/
irbrc
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
# Add all gems in the global gemset to the $LOAD_PATH so they can be used in rails3 console with bundler
if defined?(::Bundler)
$LOAD_PATH.concat Dir.glob("#{ENV['GEM_PATH'].split(":").first}/gems/*/lib")
end
require 'rubygems'
require 'pp'
begin
require 'brice/init'
require 'awesome_print'
require 'hirb'
require 'looksee'
AwesomePrint.defaults = { indent: 2 }
AwesomePrint.irb! if defined? AwesomePrint
rescue LoadError
puts "# Ensure Brice, AwesomePrint, Hirb, and Looksee for the best irb experience."
puts "#"
puts "# gem install brice awesome_print hirb looksee"
puts ""
end
def source_for(object, method_sym)
if object.respond_to?(method_sym, true)
method = object.method(method_sym)
elsif object.is_a?(Module)
method = object.instance_method(method_sym)
end
location = method.source_location
`vim #{location[0]} +#{location[1]}` if location
location
rescue
nil
end