class Shamu::Rack::QueryParams
Expose the query string and post data parameters as a hash.
Attributes
env[R]
Public Class Methods
create( * )
click to toggle source
@return [QueryParams]
# File lib/shamu/rack/query_params.rb, line 8 def self.create( * ) fail "Add Shamu::Rack::QueryParamsMiddleware to use Shamu::Rack::QueryParams" end
new( env )
click to toggle source
@param [Hash] env the Rack
environment
# File lib/shamu/rack/query_params.rb, line 13 def initialize( env ) @env = env end
Public Instance Methods
get( key )
click to toggle source
Get a cookie value from the browser. @param [String] key or name of the cookie @return [String] cookie value
# File lib/shamu/rack/query_params.rb, line 20 def get( key ) key = key.to_s env_query_params[ key ] end
Also aliased as: []
key?( name )
click to toggle source
@param [String] name @return [Boolean] true if the cookie has been set.
# File lib/shamu/rack/query_params.rb, line 28 def key?( name ) env_query_params.key?( name.to_s ) end
Private Instance Methods
env_query_params()
click to toggle source
# File lib/shamu/rack/query_params.rb, line 36 def env_query_params @env_query_params ||= ::Rack::Request.new( env ).params end