Class: Rack::Manifest

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/manifest.rb,
lib/rack/manifest/version.rb

Defined Under Namespace

Classes: Railtie

Constant Summary collapse

VERSION =
"0.1.2"

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Manifest

Returns a new instance of Manifest.



8
9
10
# File 'lib/rack/manifest.rb', line 8

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/rack/manifest.rb', line 12

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