Permalink
Browse files

clean up ruby

  • Loading branch information...
1 parent 4394b51 commit 80356b71b1b723906fd6b9ff55685129ce535356 @mvj3 committed Mar 30, 2013
Showing with 7 additions and 62 deletions.
  1. +0 −29 ruby/debug.rb
  2. +7 −33 ruby/irb.rb
View
@@ -1,29 +0,0 @@
-class Object
- # returns instance methods of current object's class and its singleton methods
- def lm # abbr of local methods
- self.methods.sort - self.class.superclass.instance_methods
- end
-end
-
-module Kernel
- def db
- require 'ruby-debug'
- debugger
- end
-
- # file utility
- def ls; %x{ls -a}.split("\n")[2..-1] end
- def pwd; Dir.pwd end
- def cd(dir=nil); Dir.chdir(dir || ENV['HOME'] ) end
- def clear; system 'clear' end
- def oo; `open http://www.google.com`; end
-end
-
-if !defined?(RUBY_ENGINE) && defined?(Readline) && Readline.respond_to?(:vi_editing_mode)
- IRB.conf[:USE_READLINE] = true
- def vimode; Readline.vi_editing_mode end
- def emmode; Readline.emacs_editing_mode end
-
- # enable the vimode right now
- vimode
-end
View
@@ -1,30 +1,18 @@
-#!/usr/bin/env ruby
+# encoding: UTF-8
-module Rubygem; end
-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
+require 'rubygems'
# enable encoding in UTF-8 if current ruby version is less than 1.9
unless defined? Encoding
require 'jcode'
$KCODE='utf8'
end
-# load debug utility
-require ENV['HOME'] + '/utils/ruby/debug.rb'
-
-# load wirble
-if defined? Wirble
- Wirble.init
- Wirble.colorize
+class Object
+ # returns instance methods of current object's class and its singleton methods
+ def lm # abbr of local methods
+ self.methods.sort - self.class.superclass.instance_methods
+ end
end
# improve irb’s default output
@@ -73,17 +61,3 @@ def self.search keyword = nil
nil
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.