Ruby Weekly is a weekly newsletter covering the latest Ruby and Rails news.

This Week’s Ruby News: awesome_print 1.0, a new Sinatra book, and more

By Peter Cooper / December 3, 2011

Welcome to this week's Web-based syndication of Ruby Weekly - it's bumper sized this week. And a big congratulations to David Heinemeier Hansson, creator of Rails, as he got married recently!


Sinatra: Up and RunningĀ (New Book from O'Reilly)
A new book from O'Reilly, written by Alan Harris and Konstantin Hasse, that takes a look at the popular Sinatra Ruby webapp library. It's available in e-book and print formats.

awesome_print 1.0 Released
OK, it's already at 1.0.1, but Michael Dvorkin's awesome 'pretty printer' for Ruby objects has reached its 1.0 milestone. This is definitely one of my favorite Ruby projects.

Articles and Tutorials

Method Chaining and Lazy Evaluation in Ruby
Ever wondered how that ActiveRecord query style method chaining works? Jeff Kreeftmeijer shows you one way to go about implementing your own method chaining mechanism.

Implementing Autocomplete with Redis in Rails 3.1
Pat Shaughnessy demonstrates how to set up a Rails 3.1 app to do Redis-backed autocompletion using the Soulmate library. Very detailed and a lot to learn here.

Ruby Blocks as Dynamic Callbacks
A callback is a block of code passed as an argument to a method which can be run under certain conditions later on. Matt Sears shows off a clever technique to have multiple types of callback within a single code block which can be triggered independently.

Rails 3.2 Gets 'pluck' Method, Returns Array of Table Column Values
ActiveRecord::Relation#pluck is used to get values from a single column of a table. It accepts a column name as its argument and returns an array of values. It'll be in the forthcoming Rails 3.2 or, if you're brave, is in head now.

The State of Ruby ORMs
Piotr Solnica presents a roundup of the popular Ruby ORMs (Object Relational Mappers) ActiveRecord, DataMapper, and Sequel.

Xavier Shay's DataMapper Retrospective
Xavier used DataMapper, rather than ActiveRecord, on his last two major projects and in this post he shares what he sees as the pros and cons of the DataMapper approach.


In-Place Editing - RailsCasts
Ryan Bates's weekly screencast outing shows us how to edit an on-page attribute in-place using the 'Best In Place' gem. He also shows how to add validations and support for different field types.

Pat Shaughnessy on Bundler 1.1
I've recently linked to a couple of great articles by Pat about Bundler 1.1's new features and performance improvements but if you want it in 20 minute video form.. here you go :-)

The Ruby Rogues on Software Craftsmanship
The latest episode of the always awesome Ruby Rogues podcast looks at 'software craftsmanship', code retreats, and developer apprentice programs.

Building a Rails Plugin with Tested Assets (Screencast)
An hour long screencast by Dmytrii Nagirniak working in real time on a Rails plugin, along with using Sass, Jasmine, and CSS assets. Be warned, however, it's not a particularly easy watching experience, even at fullscreen.

Cut and Polish: A Guide to Crafting Gems
At the RubyC conference in Ukraine, Pat Allan gave a talk about building gems, some of the tools you can use, and some best practices. All 47 minutes of it is now available to watch here too.

Libraries and code

Jbuilder: DHH's JSON Production Library
Despite getting married this week, DHH has still been busy coding. Jbuilder gives you a simple DSL for declaring JSON structures that beats massaging giant hash structures. This is particularly helpful when the generation process is fraught with conditionals and loops.

Wash Out: A Simple Rails 3 SOAP Server Library
Wash Out is a gem that greatly simplifies creation of SOAP service providers within Rails 3 applications.

Methadone - Build Better Ruby-based CLIs with Logging and Cucumber Support
Methadone (gotta love these project names..) is a collection of tools 'to make your command-line apps easily awesome'. It includes a DSL that wraps OptionParser, logging utility classes, and Cucumber steps.

Command Line Reporter: Nicer Formatting for Ruby Script Output
Command Line Reporter offers RSpec-like formatting of the output of your Ruby scripts. Rather than using "puts" statements everywhere, you can lean on CLR's extensible methods and formatters.

Moxy: A Programamble Mock HTTP Proxy
Moxy (or moxy) is a programmable mock proxy. It is an HTTP proxy exposing web hooks that you can use in order to tell it what to do, and when to do it.

Ruby Jobs of the Week

Last but not least..

Ruby Command-Line One-Liners (Working, This Time)
Due to a Tumblr bug, this link didn't work properly in last week's Ruby Weekly so it's in again.. a bumper collection of Ruby one-liners you can use from the command line, mostly to perform various functions on files and other streaming data.

Other Posts to Enjoy

Twitter Mentions