-
Notifications
You must be signed in to change notification settings - Fork 2
/
pryrc
46 lines (40 loc) · 1.25 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
# Prompt with ruby version
Pry.config.prompt = Pry::Prompt.new(
"ruby",
"Ruby Version",
[
proc { |obj, nest_level| "#{RUBY_VERSION} [#{ Rails.application.class.module_parent_name}] (#{obj}):#{nest_level} > " },
proc { |obj, nest_level| "#{RUBY_VERSION} (#{obj}):#{nest_level} * " }
]
) if defined?(Rails) && Rails.respond_to?(:application)
# Pry + Hirb - https://github.com/pry/pry/wiki/FAQ#wiki-hirb
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
if defined?(PryRails::RAILS_PROMPT)
Pry.config.prompt = PryRails::RAILS_PROMPT
end
if defined?(Doorkeeper::AccessToken)
Doorkeeper::AccessToken.define_method :siblings do
self.class.where(resource_owner_id: resource_owner_id, application_id: application_id).order(created_at: :desc)
end
end