forked from kirel/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpryrc.symlink
More file actions
47 lines (40 loc) · 1.09 KB
/
pryrc.symlink
File metadata and controls
47 lines (40 loc) · 1.09 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
42
43
44
45
46
47
# vim FTW
Pry.config.editor = "mvim"
# Prompt with ruby version
Pry.prompt = [proc { |obj, nest_level| "#{RUBY_VERSION} (#{obj}):#{nest_level} > " }, proc { |obj, nest_level| "#{RUBY_VERSION} (#{obj}):#{nest_level} * " }]
if defined?(Rails) && Rails.env
begin
extend Rails::ConsoleMethods if defined?(Rails::ConsoleMethods)
require "rails/console/app"
require "rails/console/helpers"
rescue LoadError => e
require "console_app"
require "console_with_helpers"
end
def loud_logger
set_logger_to Logger.new(STDOUT)
end
def quiet_logger
set_logger_to nil
end
def set_logger_to(logger)
ActiveRecord::Base.logger = logger
ActiveRecord::Base.clear_active_connections!
end
end
begin
require "awesome_print"
AwesomePrint.pry!
rescue LoadError => err
warn "=> Unable to load awesome_print"
end
begin
require "hirb"
Hirb.enable
lambda do
_pry_print = Pry.config.print
Pry.config.print = proc { |output, value| Hirb::View.view_or_page_output(value) || _pry_print.call(output, value) }
end.call
rescue LoadError
warn "=> Unable to load hirb"
end