Sha256: 1a018bfcaef8ad95b4792a22b906ed550c69c428d73b7fb790ed920ed0db6bdb

Contents?: true

Size: 525 Bytes

Versions: 1

Compression:

Stored size: 525 Bytes

Contents

require 'yaml'
require 'json'
require 'rack/manifest/version'
require 'rack/manifest/rails' if defined?(Rails::Railtie)

module Rack
  class Manifest
    def initialize(app)
      @app = app
    end

    def call(env)
      if env[PATH_INFO] == '/manifest.json'
        manifest = YAML.load_file('./config/manifest.yml')
        json = JSON.generate(manifest)
        [
          200,
          {'Content-Type' => 'application/json'},
          [json]
        ]
      else
        @app.call(env)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rack-manifest-0.1.2 lib/rack/manifest.rb