The Split is Not Enough: Unicode Whitespace Shenigans for Rubyists



In the UK there's a cliché that goes: "You wait hours for a bus, and then three come along at once!" So it went with these three Ruby date and time libraries. They all made an appearance on RubyFlow last week and are all useful in their own ways, depending on how you're working with dates and times.
Over on the Ruby Best Practices blog,
Robert Klemme walks through the process of building a new numeric class from scratch in Ruby - taking into account all the gotchas and considerations that pop up along the way. Robert's task is harder and more involved than you'd initially suspect.!
Ruby Quicktips is a Tumblr-powered tumblelog (think of a blog but in bite-sized chunks) by Daniel Pietzsch that presents a growing array of Ruby related tips and interesting code snippets. Daniel seems keen for you to contribute, and you can do so on its submissions page. There's an "about us" post if you want to learn more in general.
Ruby Version Manager GitHub repo (a.k.a. RVM) makes it ridiculously easy to install and switch between multiple Ruby versions on OS X and Linux. Over the last 24 hours, I've been playing with RVM and talking to creator Wayne E. Seguin and have been blown away with how cool (and simple) it is - you will definitely want to check this one out.
In Make Your Test Suite UNCOMFORTABLY FAST! (called "the best blog post ever written" by one commenter) Jason Morrison of Thoughtbot demonstrates how to use Michael Grosser's Parallel Specs project to speed up your Ruby tests.
The Interactive Ruby Shell, more commonly known as IRB, is one of Ruby's most popular features, especially with new developers. You can bash out a one-liner, try a method you've just learned about, or even build a small algorithm or two without going the whole way to writing a complete program.
There's plenty of stuff in Ruby that I've either not noticed before, noticed but forgotten about, or otherwise failed to realize the utility of. Add to that all the awesome Ruby tricks and techniques I'm seeing in people's code over on Github lately and.. we need a new series here: Ruby Techniques Revealed!
Twibot is a Sinatra-esque "micro framework" for building Twitter bots (somewhat like Isaac is for IRC).

Berkeley DB is a high performance database system initially developed in the early 1990s. It's not an SQL driven database engine - it just stores data in key/value pairs - but BDB is very fast, available to use on most operating systems, and is dual licensed for open source and commercial use. It has several benefits to just using a flat file or a PStore: transactions, fine-grained locking, replication, and hot backups, for starters.

When you want your objects to refer to / have associations with other objects, it can quickly become a complex procedure. Ryan Daigle to the rescue! Ryan has built Roxy, a "Ruby Proxy-Object Library." He's also put together an awesome blog post with the motivation for developing Roxy and some code examples showing how it works. Roxy gives you the ability to add some rather ActiveRecord-esque functionality to your classes and their instances.
Charles Nutter, of the core JRuby team, writes:
Yesterday, Aaron Patterson (@tenderlove) and Mike Dalessio released Nokogiri (Github repository), a new HTML and XML parser for Ruby. It "parses and searches XML/HTML faster than Hpricot" (Hpricot being the current de facto Ruby HTML parser) and boasts XPath support, CSS3 selector support (a big deal, because CSS3 selectors are mega powerful) and the ability to be used as a "drop in" replacement for Hpricot.


NeverBlock is a Ruby (1.9) library developed by eSpace - an Egyptian Web 2.0 development team - that could make your life a whole lot easier if you have to deal with blocking IO operations that hold up all your Ruby threads.

Recently, Yahoo! launched BOSS - the "Build Your Own Search Service." In all but name, it appears very similar to their older Yahoo! Search API, as it allows you to query Yahoo's search index programatically. Under the surface though, Yahoo has removed the 5,000 query per day limit, you're unrestricted in how you present the data returned, you can re-order the data, and no attribution is required.



Ilya Grigorik of Igvita has put together a great article called 6 Optimization Tips for Ruby MRI. In it, he walks through six different things you can do to improve the performance of your code when running on the regular Ruby interpreter (MRI). For example, interpolation is quicker than concatenation when working with strings, destructive operations prevent wasteful object duplication, and hand-written blocks are a lot faster than Symbol#to_proc.
Trollop is a command-line argument processing library for Ruby. Developer William Morgan says Trollop is "designed to provide the maximal amount of GNU-style argument processing in the minimum number of lines of code." It makes a refreshing change to the more popular, but generally scary, cmdparse. The homepage features some examples of its usage.

Writing for Ruby Inside, I get to see a lot of Ruby code. Most is good, but sometimes we forget some of Ruby's shortcuts and tricks and reinvent the wheel instead. In this post I present 21 different Ruby "tricks," from those that most experienced developers use every day to the more obscure. Whatever your level, a refresh may help you the next time you encounter certain coding scenarios.
