Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

My .irbrc file (for the Interactive Ruby console, IRb)

branch: master

This branch is 0 commits ahead and 0 commits behind master

Fetching latest commit…

Cannot retrieve the latest commit at this time

README.rdoc

.irbrc

This is my .irbrc configuration file

Where to place it?

Place it in your home directory (~/.irbrc) or you can symlink it from other folder like this: $ cd ~ (or 'cd') $ ln -s folder/where/you/cloned/this/repo/irbrc/ruby_console_initializer.rb .irbrc

Contents

Prompt

I use a simple prompt for the IRb sessions

IRB.conf[:PROMPT_MODE] = :SIMPLE And a customized one for Rails sessions IRB.conf[:PROMPT][:RAILS] = {}

ActiveRecord log

This will print the log in the console.

IRB.conf[:IRB_RC] = Proc.new do

	logger = Logger.new(STDOUT)

ActiveRecord::Base.logger = logger …

IRb Helper methods

clear - clear the screen ri - it's a wrapper to the ri command-line ruby documentation utility

Core Extensions

Object local_methods - shows the methods of an object getting rid of the Object.instance_methods eigenclass - please read about meta-programming in Ruby to_pboard - “some text”.to_pboard copies “some text” to the Mac OS's default pasteboard (alias 'to_pb') paste - it pastes the content of the Mac OS's default pasteboard to_find - a wrapper to to_pboard :find ql - do you know the QuickLook feature on Mac OS? well, “path/to/folder_or_image”.ql will show you the folder stats or the image, Ctrl-C will close it

Class class_methods defined_methods - returns a hash with two keys :instance (instance methods) and :class (class methods) metaclass - returns the eigenclass the “include” method is a public one to help to include modules easily.

Aliases

q => exit cl => clear (helper method)

Note on Patches/Pull Requests

  • Fork the project.

  • Make your feature addition or bug fix.

  • Send me a pull request. Bonus points for topic branches.

Copyright

Forked by John Gibb

Copyright © 2010 Rafael Magaña. See LICENSE for details.

Something went wrong with that request. Please try again.