Permalink
Browse files

Merge pull request #267 from radar/master

HWIA#to_hash should convert to normal Hash objects
  • Loading branch information...
2 parents 976de90 + 5253be5 commit 6f1b6b7650842614bcc9003939a4dca8cebb8ffd @wycats wycats committed Oct 22, 2012
@@ -45,6 +45,11 @@ def merge!(other)
self
end
+ # Convert to a Hash with String keys.
+ def to_hash
+ Hash.new(default).merge!(self)
+ end
+
protected
def convert_key(key)
@@ -40,4 +40,9 @@
expect(other[:force]).to eq(false)
expect(other[:baz]).to eq("boom")
end
+
+ it "converts to a traditional hash" do
+ expect(@hash.to_hash.class).to eq(Hash)
+ expect(@hash).to eq({ 'foo' => 'bar', 'baz' => 'bee', 'force' => true })
+ end
end

0 comments on commit 6f1b6b7

Please sign in to comment.