lib/lotus/frameworks.rb in lotusrb-0.1.0 vs lib/lotus/frameworks.rb in lotusrb-0.2.0

- old
+ new

@@ -1,37 +1,26 @@ require 'lotus/router' -require 'lotus/controller' require 'lotus/view' +require 'lotus/controller' -# FIXME Ideally, this should be done like this: -# -# module Lotus -# module Frameworks -# module Action -# module Rack -# protected -# def response -# [super, self].flatten -# end -# end -# end -# end -# end -# -# Lotus::Action::Rack.class_eval do -# include Lotus::Frameworks::Action::Rack -# end -# -# ..but it doesn't work and I want to ship it! +module Lotus + module Frameworks + module Action + module Rack + ENV_KEY = 'lotus.action'.freeze -Lotus::Action::Rack.class_eval do - DEFAULT_RESPONSE_CODE = 200 - DEFAULT_RESPONSE_BODY = [] - - protected - def response - [ @_status || DEFAULT_RESPONSE_CODE, headers, @_body || DEFAULT_RESPONSE_BODY.dup, self ] + protected + def finish + super + @_env[ENV_KEY] = self + end + end + end end +end + +Lotus::Action::Rack.class_eval do + prepend Lotus::Frameworks::Action::Rack end Lotus::Action.class_eval do def to_rendering exposures.merge(format: format)