Class: Shamu::Rack::QueryParams
- Inherits:
-
Object
- Object
- Shamu::Rack::QueryParams
- 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
-
#get(key) ⇒ String
(also: #[])
Get a cookie value from the browser.
-
#initialize(env) ⇒ QueryParams
constructor
A new instance of QueryParams.
-
#key?(name) ⇒ Boolean
True if the cookie has been set.
Constructor Details
#initialize(env) ⇒ QueryParams
Returns a new instance of QueryParams.
13 14 15 |
# File 'lib/shamu/rack/query_params.rb', line 13 def initialize( env ) @env = env end |
Class Method Details
.create ⇒ QueryParams
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
Returns true if the cookie has been set.
28 29 30 |
# File 'lib/shamu/rack/query_params.rb', line 28 def key?( name ) env_query_params.key?( name.to_s ) end |