Created
February 9, 2013 21:28
-
-
Save bsbodden/4747184 to your computer and use it in GitHub Desktop.
My .irbrc file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rbconfig' | |
Config = RbConfig | |
if defined?(Rails) | |
Dir.glob("#{Rails.root}/app/models/**/*.rb").each { |file| require file } | |
end | |
def clear | |
system 'clear' | |
nil | |
end | |
begin | |
require 'hirb' | |
Hirb.enable | |
extend Hirb::Console | |
def render(table) | |
Hirb::Helpers::AutoTable.render(table) | |
end | |
rescue Exception => e | |
# no Hirb for you! | |
end | |
class Class | |
def extend?(klass) | |
not superclass.nil? and ( superclass == klass or superclass.extend? klass ) | |
end | |
end | |
def models | |
Module.constants.select do |constant_name| | |
constant = eval constant_name.to_s | |
if not constant.nil? and constant.is_a? Class and constant.extend? ActiveRecord::Base | |
constant | |
end | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment