Verbose Logging

software development with some really amazing hair

T + G I F R

Simple Ruby Pipes

· · Posted in Programming
Tagged with

Here's something I cooked up this evening. Nothing too epic, but it's a neat illustration of metaprogramming with ruby.

Ruby allows you to reopen classes and add methods to them. You can also make a Module and include that in a class to add methods. I've added four methods to the Symbol class and overridden one method in the Array class (using alias to keep the old method around since super doesn't quite work).

Now we can pipe arrays like bash using a simple syntax! Wee!