-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathirbrc
executable file
·41 lines (35 loc) · 911 Bytes
/
irbrc
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
# KDR: need to require in date explicitly b/c
# rubygems monkeypatches the Date class without
# actually requiring it in
require 'date'
require 'rubygems'
# print ActiveRecord SQL to STDOUT
if ENV.include?('RAILS_ENV') && !Object.const_defined?('RAILS_DEFAULT_LOGGER')
# Rails 2
require 'logger'
RAILS_DEFAULT_LOGGER = Logger.new(STDOUT)
elsif defined?(Rails)
# Rails 3
if Rails.logger
Rails.logger = Logger.new(STDOUT)
ActiveRecord::Base.logger = Rails.logger
end
end
# Autocomplete
require 'irb/completion'
# History
unless IRB.conf[:HISTORY_FILE]
begin
require 'irb/ext/save-history'
rescue LoadError
require 'irb/ext/eval_history'
end
IRB.conf[:SAVE_HISTORY] = 100
IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb_history"
end
# Easily print methods local to an object's class
class Object
def local_methods
(methods - Object.instance_methods).sort
end
end