From d5e899f80499a9b2b534c1d010230373f31d3a86 Mon Sep 17 00:00:00 2001 From: Vincent Batts Date: Mon, 6 Aug 2012 16:47:54 -0400 Subject: [PATCH] get_child feels like java --- thing.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/thing.rb b/thing.rb index 1e8d886..c95cbcf 100644 --- a/thing.rb +++ b/thing.rb @@ -69,7 +69,7 @@ class Node @children.has_key? key end - def get_child(name) + def [](name) @children[name] end @@ -121,7 +121,7 @@ def mk_hash(sgmts, parent) unless parent.has_key?(segment) parent.children[segment] = mk_hash(sgmts, Node.new(segment)) else - mk_hash(sgmts, parent.get_child(segment)) + mk_hash(sgmts, parent[segment]) # else # hash[segment].update(mk_hash(sgmts, hash[segment])) end