Class: Tablets::Data::Processing::Order

Inherits:
Base
  • Object
show all
Defined in:
lib/tablets/data/processing/order.rb

Overview

Incapsulate relation ordering logic.

Instance Method Summary collapse

Methods inherited from Base

apply, #initialize

Constructor Details

This class inherits a constructor from Tablets::Data::Processing::Base

Instance Method Details

#apply(relation) ⇒ Object

Applies order processing on relation.



9
10
11
12
13
# File 'lib/tablets/data/processing/order.rb', line 9

def apply(relation)
  params[:order].values.inject(relation) do |rel, item|
    rel.order("#{column(item)} #{direction(item)}")
  end
end