Getting to Know the Ruby Standard Library – Shellwords
This article has been republished on Monkey and Crow. Previously we answered a few questions about Minitest, and learned a little about exit hooks and introspection in ruby. Now lets look at an often...
View ArticleGetting Help Inside IRB
Here’s a quick tip, ruby’s ri utility will look up documentation about a method. For instance you can type ri String#split to see the documentation for String’s instance method split. If you have an...
View ArticleGetting to Know the Ruby Standard Library – MiniTest::Mock
This article has been republished on Monkey and Crow. Recently we looked at MiniTest, this time around we’re going to dive into MiniTest::Mock, a tiny library that will let you test systems that would...
View ArticleGetting to Know the Ruby Standard Library – TSort
This article has been republished on Monkey and Crow. TSort is an interesting part of the ruby standard library that performs topological sorting. Topological sorting is used in package management,...
View ArticleHash Tricks
Ruby’s Hash can accept a block when you initialize it. The block is called any time you attempt to access a key that is not present. Hash’s initialization block expects the following format:...
View ArticleFinding Binaries with Ruby
Here’s a quick one liner in ruby that finds all of the binaries on your PATH: Dir[*ENV['PATH'].split(':').map{|p| p+"/*"}].select{|f| File.executable? f}.map{|f| File.basename f}.uniq How does it work?...
View ArticleGetting to Know the Ruby Standard Library – Abbrev
This article has been republished on Monkey and Crow. We’re going to take a look at another little piece of ruby’s standard library, this time it is Abbrev, a tiny library that generates abbreviations...
View ArticleGetting to Know the Ruby Standard Library – Pathname
This article has been republished on Monkey and Crow. Pathname is useful library that demonstrates a good refactoring: “Replace Data Value With Object”. In this case the data value is a String...
View ArticleQwandry 0.1.0 – Now Supporting More Languages
I just finished updating Qwandry so that it can support any number of other languages or packaging systems. Want to use perl, python, or node with Qwandry? No problem: qw -r python numpy # opens...
View ArticleGetting to Know the Ruby Standard Library – Timeout
This article has been republished on Monkey and Crow. I asked for suggestions about what to cover next, and postmodern suggested the Timeout library among others. Timeout lets you run a block of code,...
View Article