./lib/lux/application/application.rb in lux-fw-0.2.1 vs ./lib/lux/application/application.rb in lux-fw-0.2.3

- old
+ new

@@ -6,44 +6,46 @@ # define common http methods as constants [:get, :head, :post, :delete, :put, :patch].map(&:to_s).map(&:upcase).each { |m| eval "#{m} ||= '#{m}'" } ### - def initialize + def initialize current + @current = current @route_test = Lux::Application::RouteTest.new self end def debug { :@locale=>@locale, :@nav=>nav, :@subdomain=>@subdomain, :@domain=>@domain } end def body? - Lux.current.response.body ? true : false + @current.response.body ? true : false end def body data - Lux.current.response.body data + @current.response.body data end def current - Lux.current + # Lux.current + @current end def nav - Lux.current.nav + @current.nav end def params - Lux.current.params + @current.params end def redirect where, msgs={} - Lux.current.redirect where, msgs + @current.redirect where, msgs end def request - Lux.current.request + @current.request end # gets only root def root cell if RouteTest::LUX_PRINT_ROUTES @@ -53,19 +55,19 @@ call cell unless nav.root end def done? - throw :done if Lux.current.response.body + throw :done if @current.response.body end def get? - Lux.current.request.request_method == 'GET' + @current.request.request_method == 'GET' end def post? - Lux.current.request.request_method == 'POST' + @current.request.request_method == 'POST' end def plug name, &block done? @@ -175,8 +177,18 @@ ClassCallbacks.execute self, :after rescue => e ClassCallbacks.execute self, :on_error, e end end + end + + def render + Lux.log "\n#{current.request.request_method.white} #{current.request.path.white}" + + Lux::Config.live_require_check! if Lux.config(:auto_code_reload) + + main + + current.response.render end end \ No newline at end of file