-
Notifications
You must be signed in to change notification settings - Fork 8
/
.pryrc
57 lines (50 loc) · 1.13 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
begin
require 'hirb'
rescue LoadError
# Missing goodies, bummer
end
if defined? Hirb
# 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 SQL output
if defined?(Rails) && !Rails.env.nil?
if Rails.logger
Rails.logger =Logger.new(STDOUT)
ActiveRecord::Base.logger = Rails.logger
end
end
class Object
def interesting_methods
case self.class
when Class
self.public_methods.sort - Object.public_methods
when Module
self.public_methods.sort - Module.public_methods
else
self.public_methods.sort - Object.new.public_methods
end
end
end
module Kernel
def require_relative(file)
$:.unshift Dir.pwd
require file
end
def guid(s)
s.scan(/[a-f0-9-]{36}/).first
end
end