This repository has been archived by the owner on Apr 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.pryrc
62 lines (49 loc) · 1.66 KB
/
.pryrc
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# Pry configuration
Pry.prompt = [
proc { |obj, nest_level| "#{RUBY_VERSION} (#{obj}):#{nest_level} > " },
proc { |obj, nest_level| "#{RUBY_VERSION} (#{obj}):#{nest_level} * " },
]
Pry.config.theme = 'solarized'
# from https://github.com/pry/pry/wiki/FAQ#how-do-i-stop-executing-a-bindingpry-call-in-a-loop
Pry::Commands.block_command('enable-pry', 'Enable `binding.pry` feature') do
ENV['DISABLE_PRY'] = nil
end
# Awesome Print ----------------------------------------------------------------------------
begin
require 'awesome_print'
rescue LoadError
else
AwesomePrint.pry!
end
# Looksee ----------------------------------------------------------------------------------
begin
require 'looksee'
rescue LoadError
else
Looksee.editor = 'vim %f +%l' if defined? Looksee
end
# Hirb -------------------------------------------------------------------------------------
begin
require 'hirb'
rescue LoadError
else
# from https://github.com/pry/pry/wiki/FAQ#how-can-i-use-the-hirb-gem-with-pry
# Slightly dirty hack to fully support in-session Hirb.disable/enable toggling
Hirb::View.instance_eval do
def enable_output_method
@output_method = true
@old_print = Pry.config.print
Pry.config.print = proc do |*args|
Hirb::View.view_or_page_output(args[1]) || @old_print.call(*args)
end
end
def disable_output_method
Pry.config.print = @old_print
@output_method = nil
end
end
Hirb.enable
end
# Rails ------------------------------------------------------------------------------------
# load Rails config if running as a Rails console
load File.dirname(__FILE__) + '/.railsrc' if defined? Rails && Rails.env