Permalink
Browse files

clean up ruby

  • Loading branch information...
mvj3 committed Mar 30, 2013
1 parent 4394b51 commit 80356b71b1b723906fd6b9ff55685129ce535356
Showing with 7 additions and 62 deletions.
  1. +0 −29 ruby/debug.rb
  2. +7 −33 ruby/irb.rb
View

This file was deleted.

Oops, something went wrong.
View
@@ -1,30 +1,18 @@
#!/usr/bin/env ruby # encoding: UTF-8
module Rubygem; end require 'rubygems'
def Rubygem.multiple_require gems = []
require 'rubygems'
Kernel.class_eval { gems.map &method(:require) }
end
Rubygem.multiple_require %w[rubygems pp irb fileutils uri pathname]
# Aliases
alias x exit
alias p pp
# enable encoding in UTF-8 if current ruby version is less than 1.9 # enable encoding in UTF-8 if current ruby version is less than 1.9
unless defined? Encoding unless defined? Encoding
require 'jcode' require 'jcode'
$KCODE='utf8' $KCODE='utf8'
end end
# load debug utility class Object
require ENV['HOME'] + '/utils/ruby/debug.rb' # returns instance methods of current object's class and its singleton methods
def lm # abbr of local methods
# load wirble self.methods.sort - self.class.superclass.instance_methods
if defined? Wirble end
Wirble.init
Wirble.colorize
end end
# improve irb’s default output # improve irb’s default output
@@ -73,17 +61,3 @@ def self.search keyword = nil
nil nil
end end
end end
module Mvj3
module Sql
extend self
def delete_all_records_and_set_auto_increment_to_one *models
models.map(&:table_name).each do |tn|
ActiveRecord::Base.connection.execute("DELETE FROM #{tn}")
ActiveRecord::Base.connection.execute("ALTER TABLE #{tn} AUTO_INCREMENT = 1")
end
end
end
end

0 comments on commit 80356b7

Please sign in to comment.