Skip to content

Instantly share code, notes, and snippets.

$ gem list rspec
*** LOCAL GEMS ***
$ sudo gem install rspec --prerelease
Successfully installed rspec-core-2.0.0.a2
Successfully installed rspec-expectations-2.0.0.a2
Successfully installed rspec-mocks-2.0.0.a2
Successfully installed rspec-2.0.0.a2
4 gems installed
Feature: code-breaker submits guess
The code-breaker submits a guess of four numbers. The game marks the guess
with + and - signs.
For each number in the guess that matches the number and position of a number
in the secret code, the mark includes one +. For each number in the guess
that matches the number but not the position of a number in the secret code,
a - is added to the mark.
require 'benchmark'
n = 1_000_000
h = {:a => {'a' => 'A'}, :b => {'b' => 'B'}}
puts %Q{
h.each {|kv| kv[1]}
}
Benchmark.benchmark do |bm|