Skip to content

Instantly share code, notes, and snippets.

@AndrewRadev
Created May 27, 2011 08:47
Show Gist options
  • Save AndrewRadev/994872 to your computer and use it in GitHub Desktop.
Save AndrewRadev/994872 to your computer and use it in GitHub Desktop.
Odd behaviour for pp with ActiveSupport::OrderedHash
# Ruby 1.8.7-p330
# ActiveSupport 3.0.7
require 'rubygems'
require 'active_support/ordered_hash'
require 'pp'
test = ActiveSupport::OrderedHash.new
test[:one] = 1
test[:two] = 2
test[:three] = 3
puts test.inspect
# => #<OrderedHash {:two=>2, :three=>3, :one=>1}>
#
# Alright, this seems sensible
pp test
# => {[:one, 1]=>nil, [:two, 2]=>nil, [:three, 3]=>nil}
#
# ... Wait, what?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment