Sha256: 08c87eca6671af6b6aa252e0de6a599e42ca6ec99a31226e8a93dc5afe551229
Contents?: true
Size: 750 Bytes
Versions: 21
Compression:
Stored size: 750 Bytes
Contents
# frozen_string_literal: true require 'drillbit/parameters/sort' module Drillbit module Resource module Processors class Sorting attr_accessor :resource, :parameters # rubocop:disable Style/OptionHash def initialize(resource, parameters = {}) self.resource = resource self.parameters = Parameters::Sort.new(parameters['sort']) end # rubocop:enable Style/OptionHash def self.processed(*attrs) new(*attrs).processed end def self.meta(*attrs) new(*attrs).meta end def processed return resource unless parameters.present? resource.order(parameters.to_h) end def meta return {} unless parameters.present? { 'sort' => parameters.to_h, } end end end end end
Version data entries
21 entries across 21 versions & 1 rubygems