From e994597d42fcc3d96e34c3f248309e542e339189 Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Mon, 6 Aug 2012 17:21:44 -0400 Subject: [PATCH] adding a #to_h method for the Node object --- thing.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/thing.rb b/thing.rb index 441dbcf..a19e529 100644 --- a/thing.rb +++ b/thing.rb @@ -100,6 +100,11 @@ class Node def to_json(*a) @children.to_json(*a) end + + def to_h + @children + Hash[@children.map {|k, v| [k, v.to_h] }] + end end def akamai_hex_to_content_set(akamai_hex)