Module: Sinatra::Muster::Helpers
- Defined in:
- lib/sinatra/muster.rb
Overview
Sinatra helpers for working with Muster query string parsing strategies
Instance Method Summary collapse
-
#query ⇒ Muster::Results
Returns the parsed and filtered query options from Muster::Rack.
-
#query_filter(key, *options) ⇒ void
Add a filter to be applied to the data in #query results.
Instance Method Details
#query ⇒ Muster::Results
Returns the parsed and filtered query options from Muster::Rack
73 74 75 |
# File 'lib/sinatra/muster.rb', line 73 def query muster_query.filtered end |
#query_filter(key, *options) ⇒ void
This method returns an undefined value.
Add a filter to be applied to the data in #query results
If you pass a scalar value instead of a Hash into options, it will be treated as the default, just like Hash#fetch does.
If you pass nothing into the options argument, it will return all values if the key exists or raise a KeyError like Hash#fetch.
55 56 57 |
# File 'lib/sinatra/muster.rb', line 55 def query_filter( key, * ) muster_query.add_filter( key, * ) end |