Module: Concerns::Sortable

Included in:
PriceManager
Defined in:
lib/concerns/concerns.rb

Instance Method Summary collapse

Instance Method Details

#sort_by_locationObject



49
50
51
# File 'lib/concerns/concerns.rb', line 49

def sort_by_location
  search_by_type.sort{|a,b| a.location <=> b.location}
end

#sort_by_priceObject



41
42
43
# File 'lib/concerns/concerns.rb', line 41

def sort_by_price
  items_with_price.sort{|a,b| a.price <=> b.price}
end

#sort_by_price_in_rangeObject



45
46
47
# File 'lib/concerns/concerns.rb', line 45

def sort_by_price_in_range
  items_in_price_range.sort{|a,b| a.price <=> b.price}
end