About
Buy my book
Exceptional Ruby is the definitive guide to exceptions and failure handling in Ruby.
Pages
Categories
End your OOP Confusion with the Design Pattern Classifier
The Ruby community has seen a renaissance of interest in classic Object-Oriented thinking lately. We’re talking about Presenters, and DCI, and Data Objects. But with these new discussions come new problems. Namely: the dreaded pattern terminology debate. He says it’s a Decorator. … Continue reading
Fancy GitHub Authentication with Omniauth
Configuring Omniauth for GitHub authentication is easy enough. But I needed to optionally add extra permissions to the authentication token. I eventually figured it out, but since I had to piece the steps together from various sources, I thought I’d … Continue reading
Another Take on Smalltalk-Style Controll Flow (SBPP #6)
The latest Smalltalk-to-Ruby translation in my SBPPRB archive is “Dispatched Interpretation”. It’s one of the bigger ones I’ve tackled so far. I’m not going to go over the whole pattern here; for that you’ll just need to buy a copy … Continue reading
Object Oriented Programming Books
A few people have asked for recommendations of good foundational Object Oriented Programming texts. The truth is I’m kind of behind on my formal OOP reading, and some of the early texts I read I wouldn’t recommend. My first proper OOP book was … Continue reading
Testing that a block is called
CapnKernul asks: Hey Avdi. How would you test that a method’s provided block is called in RSpec? Would you stub #to_proc (for &block) and mock #call? Typically the way I test that a block is called goes something like this: … Continue reading
Early access beta of “Objects on Rails” Now Available
Often, at conferences and users group meetings, I find myself discussing the intersection of Ruby on Rails, Object-Oriented development, and Test-Driven Development, and I’ll mention something like “I prefer to develop my business objects first, and add ActiveRecord in later”. This usually leads to … Continue reading
Running Emacs as a Server (Emacs Reboot #15)
Unlike more lightweight editors, it doesn’t really make sense to run a new instance of Emacs whenever editing a file. Emacs is at its best when managing many buffers, frames, and windows from a single master process. That way you … Continue reading
Starting Points for Pushing Async Notifications to Browsers
I asked on Twitter for some starting points on pushing asynchronous notifications to web browsers. Here are the results, summarized. Continue reading
Posted in Uncategorized
Tagged asychronous, html5, javascript, notifications, push, web, websockets
6 Comments
DRYing up your validations using DB reflection
Avoiding silent truncation of your model fields requires putting length validations on them. But this can introduce duplication of knowledge. In this post I demonstrate how to pull limit information directly from the DB into your model validations. Continue reading
