lib/gambiarra/app.rb in gambiarra-0.0.5 vs lib/gambiarra/app.rb in gambiarra-0.0.6

- old
+ new

@@ -20,20 +20,19 @@ else memo[0] = [memo[0], segment].compact.join(' ') end end - response = {path: (path || ''), **params} - loop { response = app.flow(**response) } + responses = [{ path: (path || ''), **params }] + loop { responses << (app.flow(**responses.last) || {}) } end def self.app @app ||= new end def initialize(debugging: false) - debugging = true setup if respond_to?(:setup) @debugging = debugging @router = Router.new end @@ -69,10 +68,10 @@ def app_name self.class.to_s.split('::').first.underscore.gsub('_', '-') end - def flow(response) + def flow(**response) raise 'Response is empty' unless response output(response) response.delete(:content) questions = response&.delete(:questions) || {} response.merge!(navigation(response)) unless response.has_key?(:path) || questions.any?