class Stoor::ReadOnly

Public Class Methods

new(app, path) click to toggle source
# File lib/stoor/read_only.rb, line 5
def initialize(app, path)
  @app, @path = app, path
end

Public Instance Methods

call(env) click to toggle source
# File lib/stoor/read_only.rb, line 9
def call(env)
  request = Rack::Request.new(env)

  if request.path_info =~ /\A\/(create|delete)/ || request.post? || request.put?
    return [302, { 'Location' => @path }, []]
  end

  @app.call(env)
end