bookest / dot_files

This URL has Read+Write access

dot_files / irbrc
100644 23 lines (18 sloc) 0.432 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
### -*- ruby-mode -*-
 
require 'irb/completion'
require 'pp'
 
IRB.conf[:AUTO_INDENT] = true
IRB.conf[:PROMPT_MODE] = :SIMPLE unless ENV["TERM"] == "dumb"
 
# Profile the provided block
def profile
  require 'profiler'
  Profiler__.start_profile
  yield
  Profiler__.stop_profile
  Profiler__.print_profile($stdout)
end
 
# Shortcut to time the provided block
def benchmark
  require 'benchmark'
  puts Benchmark.measure { yield }
end