Class: Astro::Middleware::QueryString

Inherits:
Object
  • Object
show all
Defined in:
lib/astro/middleware/query_string.rb

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ QueryString

Returns a new instance of QueryString.



5
6
7
# File 'lib/astro/middleware/query_string.rb', line 5

def initialize( app )
  @app = app
end

Instance Method Details

#call(env) ⇒ Object

Parses the asset list query string format into an array of assets and assigns it to env. Currently, asset names are simply separated by commas.



13
14
15
16
17
18
19
20
# File 'lib/astro/middleware/query_string.rb', line 13

def call( env )
  req = Rack::Request.new( env )
  str = Rack::Utils.unescape( req.query_string )

  env[ 'astro.assets' ] = str.split ':'

  @app.call env
end