Tag Archives: ruby

DisplayCase Gem Now Available

Announcing the display_case gem, an implementation of the Exhibit pattern described in (and extracted from) “Objects on Rails”. Continue reading

Posted in Announcements | Tagged , , , , , , , , | 5 Comments

Making Little Classes out of Big Ones (video)

I recently visited the Hashrocket offices in Jacksonville, and while I was there I did a Lunch & Learn talk on the topic of of breaking down too-big classes into smaller pieces. In it I went over pros and cons … Continue reading

Posted in Presentations, Videos | Tagged , , , , , , | Leave a comment

Creating Cowsays.com Part 2: Unit Tests and Cow Files

Part two in my “live”-style screencast series is now available! Watch me code up a small web app from scratch using test-driven development. In this hour-long episode, I switch from integration testing to unit testing in order to drive out … Continue reading

Posted in Announcements, Screencasts | Tagged , , , , , , | Leave a comment

FigLeaf Gem Now Available

One of the points I try to make in Objects on Rails is that you don’t need to let other libraries or frameworks dictate the public face of your objects. Just because you use ActiveRecord, for instance, to persist the … Continue reading

Posted in Announcements | Tagged , , | 5 Comments

A Ruby Conversion Idiom

@CapnKernul writes: [do you know of] a Ruby idiom for converting an object to a type if it isn’t already that type. For example, if you want to only store an attribute of type Foo, you could write an accessor … Continue reading

Posted in Ruby | Tagged , , | 7 Comments

Watch me write an app, starting from nothing. Part 1 now available!

A couple weeks ago I created cowsays.com, in an effort to introduce the joy of Cowsay to more people. In the announcement I talked about how I created the site over a 24-hour period (not counting some UI tweaks). What … Continue reading

Posted in Announcements, Screencasts, Videos | Tagged , , , | 10 Comments

Generating cows with IO.popen()

I find the subject of starting and interacting with other OS processes fascinating. A few years ago I wrote a never-completed series on the many ways to spawn off processes in Ruby: Part 1: Backticks and system() Part 2: Opening … Continue reading

Posted in Ruby | Tagged , | 2 Comments

Unless readable else confused

An exploration of why unless…else in Ruby is problematic at best. Continue reading

Posted in Ruby | Tagged | 10 Comments

Ruby Thread Locals are also Fiber-Local

I was briefly concerned that thread-local variables would not also be Fiber-local, since fibers have their own stack. This would be a problem for any code which uses thread-local variables to delimit a stack context, e.g. to implement dynamically-scoped variables … Continue reading

Posted in Ruby | Tagged , , , | 6 Comments

Preventing Recursion in Ruby

A new post on the CodeBenders blog about how to prevent a method from accidentally falling into an infinite recursion. Continue reading

Posted in Ruby | Tagged , , , | 1 Comment