Code Explainers

Code explainers tagged #default-hash

ruby
class EventEmitter
  def initialize
    @listeners = Hash.new { |hash, key| hash[key] = [] }
  end

Building an EventEmitter in Ruby

pub-sub closures callbacks
Intermediate 7 steps