Exit Wiki

Ruby's a pretty populate language that we've worked a lot with over the past years.

Table Of Contents

Debugging Tips

Ruby-Debug is your friend

Debugger.post_mortem do  
  block
end

Will do a post mortem if the block throws an exception. (Debugger.post_mortem by itself does this, but if say this is part of a Rake task you are better off using the block version of this -- rake has a lot of internal catches to prevent exceptions going out, and is hard to retrofit so the global variant of this function works).

Getting Variables and values in the scope where an exception was raised

See this answer on StackOverflow.com for a ton of code to answer this question

Open Classes are your enemy

* How To Find Where A Method Is Defined

Multiple Version Of Ruby

Multiple Versions of Ruby (with version chooser menu shell script)

OR, a real tool to do it...

The Dr Nic approved way...

AND THEN READ how to get Rubygems up with this new Ruby...

Documenting Ruby

Comments are a code smell

Places where you should use comments

Comments Should

Summary

Metaprogramming

Getting all subclasses of a class

Making new Ruby Gems

Making a new Ruby gem, and submitting it to RubyGems, with Newgem

Making a new Ruby gem, and submitting to RubyGems, with Bundler

Creating a Gem that depends on either Rails 3.0.x OR 3.1.x

RubyGems

undefined method `spec' for nil:NilClass (NoMethodError)

The answer to this seems to be that your gem cache is corrupted. Try

$ gem env gemdir
SOME_FOLDER/

$ cd SOME_FOLDER/

$ rm -rf cache

Comments:

Add comments by visiting: Ruby/Comments

Ruby (last edited 2011-08-29 19:58:48 by RyanWilcox)