Interesting Ruby Tidbits That Don’t Need Separate Posts #22
It's been just over a year since the last Interesting Ruby Tidbits That Don’t Need Separate Posts post (number 21, specifically). I think I felt that RubyFlow filled the gap for quick-fire group posts, but.. it doesn't, quite (even though it's going great guns!) There are still a lot of awesome things out there that should be highlighted here but that, perhaps, don't need their own post. So.. the series is back.
How to Write a RubyGems Command Plugin
Following on from our news about the new version of RubyGems and its plugin functionality, Gabriel Horner has put together a great tutorial that covers how to create your own plugin from scratch.
Mocks and Stubs - A Presentation by Brian Guthrie
A presentation (in video format) by Brian Guthrie on testing using mocks and stubs. It's a heavy download (193MB) but Brian strikes the right balance between code and theory with some good examples. If "mock" and "stub" are jargon words to you, check it out.
What Nick Quaranto Uses for Testing in Ruby and Rails
Nick Quaranto of Thoughtbot has put together a list of the testing tools - with accompanying notes - that he uses in his daily work. Mentioned are Shoulda, Mocha, factory_girl, Cucumber, FakeWeb, and testing from the command line.
Mio: A Tiny Io-subset Interpreter written in Ruby
This one is for the code voyeurs out there! Marc-André Cournoyer has put together a small interpreter (in pure Ruby) that will execute a subset of the Io language. It's an interesting bit of code to look at, rather than something you're going to be using anytime soon.
Fibers for Ruby 1.8.6/1.8.7
Fibers are light-weight non-preemptible threads that are provided as a feature in Ruby 1.9 (think of Ruby 1.8's threads but strip away the scheduling). Joe Damato has implemented fibers for Ruby 1.8.6 and 1.8.7. It's a patch directly against the MRI source code though, so you'll need to be pretty brave or interested to get going. Awesome work nonetheless.
MRI_Instrumentation: DTrace Hooks for MRI
mri_instrumentation is an interesting piece of work by Lourens Naudé. It provides a set of C level probes that can be used to interrogate and otherwise wrestle with the internals of any version of Ruby 1.8 MRI on a platform that supports DTrace (OS X and Solaris, primarily). This is particularly useful for low-level profiling.
Dreamy: A Dreamhost API Library for Ruby
Dreamhost is a popular budget, shared hosting ISP amongst Rubyists. It's cheap and easy to get Rack-powered apps (including Rails and Sinatra apps) running, even if they can be a little slow from time to time. Still, an interesting place to put apps if you're aware of the issues.
Weigh Your Gems
gemweight.rb is a script that calculates the memory use and load time of a given RubyGem. Works only on Linux.
Validating Data with Regular Expressions in Ruby
Brightbox's Caius Durling looks at some gotchas with using regular expressions to validate data in Ruby (and Rails).