.pryrc added

This commit is contained in:
cheetah 2012-09-03 18:12:44 +04:00
parent 6026d3b1bd
commit 7f452e29b5
1 changed files with 45 additions and 0 deletions

45
home/.pryrc Normal file
View File

@ -0,0 +1,45 @@
Pry.config.pager = false
Pry.config.editor = 'slime'
Pry.config.prompt = [proc{'? '}, proc{'| '}]
Pry.config.commands.import(Pry::CommandSet.new do
$wl__reload_file = nil
command 'reload', 'Reload specified source file or previously reloaded file by default.' do |file|
unless file
if $wl__reload_file
load($wl__reload_file)
next
end
files = Dir['*.rb']
case files.size
when 0
output.puts "No Ruby files in #{Dir.pwd}"
next
when 1
file = files.first
else
output.puts "Many Ruby files in #{Dir.pwd}:"
output.puts files.map{|f| "\t#{f}"}
next
end
end
file = file.sub(/(\.rb)?$/, '.rb')
$wl__reload_file = file
load(file)
end
alias_command 'r', 'reload'
end)
def quick(repetitions = 100, &block)
require 'benchmark'
Benchmark.bm{|b| b.report{repetitions.times(&block)}}
end
def beep
putc ?\a
nil
end