Class: AcceptableApi::Accepts
- Inherits:
-
Object
- Object
- AcceptableApi::Accepts
- Defined in:
- lib/acceptable_api/accepts.rb
Instance Method Summary collapse
-
#initialize(env) ⇒ Accepts
constructor
A new instance of Accepts.
- #order(mime_types) ⇒ Object
Constructor Details
#initialize(env) ⇒ Accepts
Returns a new instance of Accepts.
6 7 8 |
# File 'lib/acceptable_api/accepts.rb', line 6 def initialize env self.request = Rack::Accept::Request.new env end |
Instance Method Details
#order(mime_types) ⇒ Object
10 11 12 13 14 |
# File 'lib/acceptable_api/accepts.rb', line 10 def order mime_types ordered = request.media_type.sort_with_qvalues mime_types, false ordered.map! { |q, mt| mt } ordered end |