Skip to content

Instantly share code, notes, and snippets.

# What is it with you people and your singletons?
class Hash
def self.from_block(&block)
Hash[*BlockBuilder.new(&block).collected]
end
class BlockBuilder
attr_reader :collected