Sha256: 8a2b87f0b147c142f75afe09c9c4cd98d64dedddf07709e2223d9306d82a911e

Contents?: true

Size: 446 Bytes

Versions: 3

Compression:

Stored size: 446 Bytes

Contents

require 'partiarelic/app'

module Partiarelic
  class Middleware
    def initialize(app, options={})
      @app = app
      @options = options
      @partiarelic_app = App.new(options)
    end

    ACCEPT_METHODS = %w[GET HEAD].freeze

    def call(env)
      if env['PATH_INFO'] == @options[:path] && ACCEPT_METHODS.include?(env['REQUEST_METHOD'])
        @partiarelic_app.call(env)
      else
        @app.call(env)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
partiarelic-0.1.2 lib/partiarelic/middleware.rb
partiarelic-0.1.1 lib/partiarelic/middleware.rb
partiarelic-0.1.0 lib/partiarelic/middleware.rb