Sha256: d606f71cdded21ab24fc05f357e72b96ebb7a79aaf88082d9311e361d8dc392a
Contents?: true
Size: 1.31 KB
Versions: 3
Compression:
Stored size: 1.31 KB
Contents
module Spontaneous::Rack::Middleware module Scope class Edit def initialize(app) @app = app end def call(env) response = nil Spontaneous::Content.scope(nil, false) do response = @app.call(env) end response end end class Preview include Spontaneous::Rack::Constants def initialize(app) @app = app @renderer = Spontaneous::Output.preview_renderer Spontaneous::Output.renderer = @renderer end def call(env) env[RENDERER] = @renderer response = nil Spontaneous::Content.scope(nil, true) do response = @app.call(env) end response end end POWERED_BY = { "X-Powered-By" => "Spontaneous CMS v#{Spontaneous::VERSION}" } class Front include Spontaneous::Rack::Constants def initialize(app) @app = app @renderer = Spontaneous::Output.published_renderer end def call(env) status = headers = body = nil env[RENDERER] = @renderer env[REVISION] = Spontaneous::Site.published_revision Spontaneous::Content.with_published do status, headers, body = @app.call(env) end [status, headers.merge(POWERED_BY), body] end end end end
Version data entries
3 entries across 3 versions & 1 rubygems