dotfiles/ruby/pryrc

31 lines
577 B
Plaintext
Raw Normal View History

2014-07-07 14:49:42 +02:00
# vim FTW
Pry.config.editor = 'vim'
# Toys methods
# See https://gist.github.com/807492
class Array
def self.toy(n=10, &block)
block_given? ? Array.new(n,&block) : Array.new(n) {|i| i+1}
end
end
class Hash
def self.toy(n=10)
Hash[Array.toy(n).zip(Array.toy(n){|c| (96+(c+1)).chr})]
end
end
if defined?(Rails) && Rails.env
require 'logger'
if defined?(ActiveRecord)
ActiveRecord::Base.logger = Logger.new(STDOUT)
ActiveRecord::Base.clear_active_connections!
end
if defined?(DataMapper)
DataMapper::Logger.new($stdout, :debug)
end
end