Class: Perron::OutputServer

Inherits:
Object
  • Object
show all
Defined in:
lib/perron/output_server.rb

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ OutputServer

Returns a new instance of OutputServer.



5
6
7
# File 'lib/perron/output_server.rb', line 5

def initialize(app)
  @app = app
end

Instance Method Details

#call(environment) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/perron/output_server.rb', line 9

def call(environment)
  return @app.call(environment) if disabled?
  return not_found if !static_file(environment) && Perron.configuration.output_server_strict

  static_file(environment).then do |file|
    file ? serve(file) : @app.call(environment)
  end
end