metautonomo.us

Confounding URL typists since 2007.

Tag Archives: ruby

Benchmarking Ruby’s Enumerable

3 Comments

Lately, I’ve been spending some time filtering data sets in Ruby. A common pattern when filtering data on multiple criteria involves short-circuiting processing at the first match or non-match, depending on whether conditions are being evaluated in an any/or or all/and context, respectively. As a result, I thought I’d run a few quick benchmarks on several implementations of this pattern. The results surprised me, so I thought I would share them here. Read the rest of this post

Filed under Blog
Jul 16, 2011

What’s new with Squeel?

0 Comments

Why, I’m glad you asked! It’s been a while since I’ve made any updates about Squeel — since before RailsConf, actually! A lot’s been added since then.
Read the rest of this post

Filed under Blog
Jul 3, 2011

“WTH is happening to Rails?” I’ll tell you.

27 Comments

I just read the blog post that got some traction on HN last night, entitled “What the hell is happening to rails?” It goes on to list a litany of complaints against changes in Rails 3.x, ranging from the default commenting of the catch-all route to, yes, of course, CoffeeScript. They all end up sounding a lot like “I don’t like change,” an argument we’ve all heard before. The difference is that Steve Coast, the post’s author, casts himself in the role of a crusader for the newbies. He says that he, personally, “gets” why these changes were made, but that the most recent versions of Rails are actually harder to learn than the older ones were. The post highlighted two things, to me:

  1. Some people still miss the point of Ruby on Rails, even after all these years.
  2. There’s a difference between “easy to learn” and “easy to use,” and when these competing goals butt heads, the latter should always win out.

Read the rest of this post

Filed under Blog
Jun 14, 2011

Book Club, May 2011

1 Comment

So, I conducted an introduction to Ruby on Rails workshop last night and just finished up a list of book recommendations for the attendees. I thought I’d share them here, in case anyone is looking for a few good starter books to learn Ruby on Rails. I went with 2 recommendations for Ruby, and 2 for Rails, because It’s really important to understand Ruby if you’re going to start hacking away at Rails. A deeper knowledge of Ruby helps make all the Rails “magic” more understandable.
Read the rest of this post

Filed under Blog
May 13, 2011

The MetaWhere 2.0 Rewrite

4 Comments

If you or have been following the rails core mailing list lately, you might have seen mention of the MetaWhere rewrite I’ve been working on. If you haven’t, let me start by linking you to the rewrite branch on GitHub. This is just a quick post explaining why I’m rewriting it, and why you should care.

Read the rest of this post

Filed under Blog
Feb 18, 2011

When to use alias_method_chain

11 Comments

Recently, I stumbled upon a fork of one of my projects in which someone made a really intelligent-sounding commit: “Remove needless indirection of alias_method_chain.” He used the term indirection, so I was duly impressed, and my curiosity was piqued: had I sinned against the programming gods and used an alias_method_chain when it wasn’t needed? No, I hadn’t. alias_method_chain is frequently abused in the Rails world, but it wouldn’t exist if there wasn’t a valid use case.
Read the rest of this post

Filed under Blog
Feb 3, 2011

attr_bucket, A Gem for Your Lolrus Model

5 Comments

Good evening, Internet! I hope you had a wonderful and productive workday. Now, with those pleasantries out of the way, I’d like to point you in the direction of a little gem called attr_bucket that I am regretful for having written even as I type this blog post suggesting you go try it. That is because this gem, while tiny and unassuming, has tremendous potential for evil.

Read the rest of this post

Filed under Blog
Jan 27, 2011

Current MetaWhere/MetaSearch Gems are RCs

1 Comment

Things have largely quieted down on the MetaSearch/MetaWhere front. The currently released gems are working well for me on a few large-ish projects, and I haven’t seen any serious bug reports in quite some time. I’m happy with the existing APIs, and while I’d certainly like to do a bit of refactoring, that’s nothing that should result in a breaking change. All this being said, I’m considering the latest releases of MW/MS as release candidates, and will be pushing out 1.0.0 of both relatively soon, barring any serious issues. Please get your bug reports in now!

Filed under Blog
Jan 13, 2011

Ruby 1.9, BasicObject, and ! (not)

2 Comments

In a recent , Joe Smith raised an issue that bothered me while I was working on my fork of Arel: predicate negation (not) has odd left-to-right readability. While only a minor annoyance, it did get me to spend some time tonight investigating a possible solution. This was when I got acquainted with Ruby 1.9′s BasicObject class, and more specifically, BasicObject#!.
Read the rest of this post

Filed under Blog
Apr 10, 2010

MetaSearch: Testers wanted

3 Comments

MetaSearch has had a bunch of nifty additions since the last released gem version. I’d really love to have some testers try out the new version, but it requires some handy additions to Arel which currently only exist on my fork. Those intrepid enough to try it out will gain a host of bug fixes, custom validators, and any- and all-suffixed methods for easier multi-condition searches.
Read the rest of this post

Filed under Blog
Apr 3, 2010