From 5bdffb3450c5551c8f94f697f7e5449b4c3756c0 Mon Sep 17 00:00:00 2001 From: agpelliza Date: Fri, 11 Jul 2014 10:40:23 -0300 Subject: [PATCH] advanced example impl --- lib/gn.rb | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/lib/gn.rb b/lib/gn.rb index 270b2a5..830e431 100644 --- a/lib/gn.rb +++ b/lib/gn.rb @@ -61,8 +61,20 @@ def edit(file) end def blueprints - Plan.constants.map do |constant| - Blueprint.new(self, Plan.const_get(constant)) + ns_classes(Plan).map do |constant| + Blueprint.new(self, constant) end end -end + + def ns_classes(const) + @ns_classes ||= [] + const.constants.each do |constant| + if const.const_get(constant).respond_to? :new + @ns_classes << const.const_get(constant) + else + ns_classes(const.const_get(constant)) + end + end + @ns_classes + end +end \ No newline at end of file