Class: Shamu::Rack::QueryParams

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

Overview

Expose the query string and post data parameters as a hash.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(env) ⇒ QueryParams



13
14
15
# File 'lib/shamu/rack/query_params.rb', line 13

def initialize( env )
  @env = env
end

Class Method Details

.createQueryParams



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

def self.create( * )
  fail "Add Shamu::Rack::QueryParamsMiddleware to use Shamu::Rack::QueryParams"
end

Instance Method Details

#get(key) ⇒ String Also known as: []

Get a cookie value from the browser.



20
21
22
23
# File 'lib/shamu/rack/query_params.rb', line 20

def get( key )
  key = key.to_s
  env_query_params[ key ]
end

#key?(name) ⇒ Boolean



28
29
30
# File 'lib/shamu/rack/query_params.rb', line 28

def key?( name )
  env_query_params.key?( name.to_s )
end