Read my latest article: 8 things I look for in a Ruby on Rails app (posted Thu, 06 Jul 2017 17:59:00 GMT)

Master, console, and servant

Posted by Sun, 02 Oct 2005 01:47:00 GMT

I love console in Rails. It is absolutely one of my favorite tools in Rails. I probably spend more time testing stuff in console than I do in a browser, which is a good thing. Right?

Today, I was reading through a part of Programming Ruby (I like to open up to a random page and read something every once in a while) and came across a section on page 189. Subsessions and Bindings I was not aware that I could do this within irb and immediately thought to myself, “can I do that with console?” Console is afterall…just irb with all the Rails features pre-configured. So, I decided that I would try this out the next time I was in console.

That time came and passed… so, does it work?

The answer: YES!

I even have proof… :-)

This should eliminate a few tabs in iterm for me and works just like the Unix jobs and fg commands do.

If you are still not using console yet, why?

Perhaps you enjoy the pain of constant browser reloads because you keep trying to figure out if that method works. Often times, you can copy and paste your code right into console. It’s beautiful and gives you a quicker response than your browser will ever. But, you already knew that. Right?

Don’t get me wrong, I can totally understand your justifications for the extra pain. Who wants to work in their terminal more than they have to? (I do… but I do it because I am at home in my terminal.) There is nothing pretty about the terminal… but I feel in control. Are you a servant of your pretty GUI IDE and browser or are you the master of your terminal? ;-)

Okay, I will end this nonsense with my new console marketing campaign. I have employeed three pigeons to help me work on this one and the end result of our hard work?

Have you ruby script/console‘d today?

Yes. Classy and Original. :-)

Back to writing…

CollectionClosureMethod

Posted by Tue, 13 Sep 2005 23:40:00 GMT

Last month, Martin Fowler posted an entry on his bliki that discussed the CollectionClosureMethod. He showed examples in Smalltalk, Lisp, and… Ruby!. It’s worth the read and he updates his bliki fairly regularly-so, I would suggest that you add his RSS feed to your RSS reader. :)

sortedEmployees = employees.sort {|a,b| a.lastname <=> b.lastname}

Enjoy!

Older posts: 1 2 3 4