-
Notifications
You must be signed in to change notification settings - Fork 4
/
.pryrc
57 lines (49 loc) · 1.62 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
# rubocop:disable
# frozen_string_literal: true
# === EDITOR ===
Pry.editor = 'vi'
# === COLORS ===
unless ENV['PRY_BW']
Pry.color = true
Pry.config.theme = 'railscasts'
end
# === Listing config ===
# Better colors - by default the headings for methods are too
# similar to method name colors leading to a "soup"
# These colors are optimized for use with Solarized scheme
# for your terminal
Pry.config.ls.separator = "\n" # new lines between methods
Pry.config.ls.heading_color = :magenta
Pry.config.ls.public_method_color = :green
Pry.config.ls.protected_method_color = :yellow
Pry.config.ls.private_method_color = :bright_black
# == PLUGINS ===
# awesome_print gem: great syntax colorized printing
# look at ~/.aprc for more settings for awesome_print
begin
require 'awesome_print'
# The following line enables awesome_print for all pry output,
# and it also enables paging
Pry.config.print = proc { |output, value| Pry::Helpers::BaseHelpers.stagger_output("=> #{value.ai}", output) }
# If you want awesome_print without automatic pagination, use the line below
module AwesomePrint
Formatter.prepend(Module.new do
def awesome_self(object, type)
if type == :string && @options[:string_limit] && object.inspect.to_s.length > @options[:string_limit]
colorize("#{object.inspect.to_s[0..@options[:string_limit]]}...", type)
else
super(object, type)
end
end
end)
end
AwesomePrint.defaults = {
string_limit: 80,
indent: 2,
multiline: true
}
AwesomePrint.pry!
rescue err
puts 'gem install awesome_print # <-- highly recommended'
end
# rubocop:enable