Skip to content

rafmagana/irbrc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

.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/dot_irbrc .irbrc

Contents

Loaded libraries

History

You’ll need to create a file called .irb-save-history in your home directory for this to work

Prompt

I use a simple prompt for the IRb sessions

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

ActiveRecord log

This will print the log in the console.

IRB.conf = 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

Rails-specific Helper methods

log_ar_to :record - Change the ActiveRecord’s logger to log/record.log log_ac_to :controller - Change the ActiveController’s logger to log/controller.log

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 © 2010 Rafael Magaña. See LICENSE for details.

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published