Class: Stylo::Rack

Inherits:
Object
  • Object
show all
Defined in:
lib/stylo/rack.rb

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Rack

Returns a new instance of Rack.



3
4
5
# File 'lib/stylo/rack.rb', line 3

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/stylo/rack.rb', line 7

def call(env)
  path = env["PATH_INFO"]

  response = Response.new(path)
  Stylo::Config.pipeline.each { |step| step.call(response) }

  if response.has_content?
    response.build
  else
    @app.call(env)
  end
end