Module: Rack::Pagelime::ClassMethods
- Included in:
- Rack::Pagelime, Rack::Pagelime
- Defined in:
- lib/rack/pagelime.rb
Instance Method Summary collapse
- #disable_processing_for_request(env) ⇒ Object
- #enable_processing_for_request(env) ⇒ Object
-
#handle_publish_callback(env) ⇒ Object
responses.
- #handle_status_check(env) ⇒ Object
- #processing_enabled_for_request?(env) ⇒ Boolean
Instance Method Details
#disable_processing_for_request(env) ⇒ Object
21 22 23 |
# File 'lib/rack/pagelime.rb', line 21 def disable_processing_for_request(env) env[TOGGLE_PROCESSING_ENV_KEY] = "off" end |
#enable_processing_for_request(env) ⇒ Object
17 18 19 |
# File 'lib/rack/pagelime.rb', line 17 def enable_processing_for_request(env) env[TOGGLE_PROCESSING_ENV_KEY] = "on" end |
#handle_publish_callback(env) ⇒ Object
responses
36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/rack/pagelime.rb', line 36 def handle_publish_callback(env) req = Rack::Request.new(env) ::Pagelime.logger.debug "PAGELIME CMS RACK PLUGIN: Route for publish callback called!" ::Pagelime.cache.clear_page(req.params["path"].to_s) ::Pagelime.cache.clear_shared [200, {"Content-Type" => "text/html"}, StringIO.new(ROUTE_RESPONSES["after_publish_callback"])] end |
#handle_status_check(env) ⇒ Object
48 49 50 51 52 53 54 55 |
# File 'lib/rack/pagelime.rb', line 48 def handle_status_check(env) req = Rack::Request.new(env) ::Pagelime.logger.debug "PAGELIME CMS RACK PLUGIN: Route for index called!" [200, {"Content-Type" => "text/html"}, StringIO.new(ROUTE_RESPONSES["index"])] end |
#processing_enabled_for_request?(env) ⇒ Boolean
25 26 27 28 29 30 31 32 |
# File 'lib/rack/pagelime.rb', line 25 def processing_enabled_for_request?(env) config_option = ::Pagelime.config.toggle_processing config_option = env[TOGGLE_PROCESSING_ENV_KEY] if config_option == "per_request" ::Pagelime.logger.debug "PAGELIME CMS RACK PLUGIN: Procesing enabled for request? (config: #{::Pagelime.config.toggle_processing}, env: #{env[TOGGLE_PROCESSING_ENV_KEY]}, evaluated as: #{config_option})" return config_option == "on" end |