Format:

I sometimes finding myself writing a class which can be initialized with an optional block for performing some action with the instance immediately after initialization:

class Logger
  def initialize
    yield(self) if block_given?
  end

  def info
Read more…