Sha256: 092a8ca638bf7144c68f5fb9ec87d53a844a093256192d5746db239aa5cdf2ac

Contents?: true

Size: 467 Bytes

Versions: 185

Compression:

Stored size: 467 Bytes

Contents

require "dry-initializer"

module Avo
  module Hosts
    class Ordering
      extend Dry::Initializer

      option :options, default: proc { {} }
      option :resource
      option :record, default: proc { resource.model }
      option :params, default: proc { resource.params }

      def order(direction)
        action = options.dig(:actions, direction.to_sym)

        if action.present?
          instance_exec(&action)
        end
      end
    end
  end
end

Version data entries

185 entries across 185 versions & 1 rubygems

Version Path
avo-2.21.0 lib/avo/hosts/ordering.rb
avo-2.21.1.pre.pr1476 lib/avo/hosts/ordering.rb
avo-2.21.1.pre.issue1450 lib/avo/hosts/ordering.rb
avo-2.21.1.pre.issue1444 lib/avo/hosts/ordering.rb
avo-2.20.0 lib/avo/hosts/ordering.rb
avo-2.19.0 lib/avo/hosts/ordering.rb
avo-2.18.1 lib/avo/hosts/ordering.rb
avo-2.18.1.pre.1.eagerloaddirs lib/avo/hosts/ordering.rb
avo-2.18.0 lib/avo/hosts/ordering.rb
avo-2.17.1.pre.5.stackedlayout lib/avo/hosts/ordering.rb
avo-2.17.1.pre.4.issue.1342 lib/avo/hosts/ordering.rb
avo-2.17.1.pre.3 lib/avo/hosts/ordering.rb
avo-2.17.1.pre.2.customauthorizationclients lib/avo/hosts/ordering.rb
avo-2.17.1.pre.1.zeitwerk.eager.load.dir lib/avo/hosts/ordering.rb
avo-2.17.0 lib/avo/hosts/ordering.rb
avo-2.16.1.pre.1.nativefields lib/avo/hosts/ordering.rb
avo-2.16.0 lib/avo/hosts/ordering.rb
avo-2.15.3 lib/avo/hosts/ordering.rb
avo-2.15.3.pre.1.data.attrs.to.sidebar.items lib/avo/hosts/ordering.rb
avo-2.15.2 lib/avo/hosts/ordering.rb