For the whole of May, I will blog about weird things in Ruby over at Idiosyncratic Ruby – Don’t miss it!
Get your Microscope for MicroLogger: A small Logger on Top of MicroEvent.rb
Being impressed by MicroEvent.js I played with the thought to use such a library not only in JavaScript, but also in Ruby. The design pattern of this kind of message passing is called observer pattern and there is also a library in Ruby’s standard library and some more on rubygems.org. However, MicroEvent.js just nails it,
value_struct: Read-only structs in Ruby
Ruby’s structs are one of my favorite data types in Ruby. They help you to keep some defined structure in the dynamic world of Ruby. Often, it makes sense to use them instead of hashes or arrays. Read-only structs take the idea a level further.
Things I learned while implementing version 1.0 of pws
After releasing version 0.9 of my cli password manager, I received friendly feedback and suggestions, which encouraged me to further improve it. Here are some of my experiences implementing pws 1.0:
Exploring the stdlib: logger
puts
is great for a quick output, but when a script gets more complex or you want to offer a flexible executable, consider using the logger ;). Since the logger class is part of the Ruby standard library, it can be used everywhere, without installing any gems. And it’s very easy to use :D