Module: HTTP::Accept::Sort
- Defined in:
- lib/http/accept/sort.rb
Class Method Summary collapse
-
.by_quality_factor(items) ⇒ Object
This sorts items with higher priority first, and keeps items with the same priority in the same relative order.
Class Method Details
.by_quality_factor(items) ⇒ Object
This sorts items with higher priority first, and keeps items with the same priority in the same relative order.
10 11 12 13 |
# File 'lib/http/accept/sort.rb', line 10 def self.by_quality_factor(items) # We do this to get a stable sort: items.sort_by.with_index{|object, index| [-object.quality_factor, index]} end |