class SmartManagement::Sorter
Public Class Methods
new(data, options)
click to toggle source
# File lib/smart_management/sorter.rb, line 3 def initialize(data, options) @data = data @options = options end
Public Instance Methods
call()
click to toggle source
# File lib/smart_management/sorter.rb, line 8 def call if @options.present? order = @options[:reverse] ? "desc" : "asc" @data = @data.order("#{@options[:predicate]} #{order}") end @data end