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.28.0 lib/avo/hosts/ordering.rb
avo-2.27.2.pre.pr1606 lib/avo/hosts/ordering.rb
avo-2.27.1 lib/avo/hosts/ordering.rb
avo-2.27.0 lib/avo/hosts/ordering.rb
avo-2.26.3.pre.pr1601 lib/avo/hosts/ordering.rb
avo-2.26.2.pre.pr1579 lib/avo/hosts/ordering.rb
avo-2.26.1.pr1584.pre.1 lib/avo/hosts/ordering.rb
avo-2.25.1.pre.1.pr1579 lib/avo/hosts/ordering.rb
avo-2.26.0 lib/avo/hosts/ordering.rb
avo-2.25.0 lib/avo/hosts/ordering.rb
avo-2.24.1 lib/avo/hosts/ordering.rb
avo-2.24.0 lib/avo/hosts/ordering.rb
avo-2.23.3.pre.1.pr1529 lib/avo/hosts/ordering.rb
avo-2.23.2 lib/avo/hosts/ordering.rb
avo-2.23.1 lib/avo/hosts/ordering.rb
avo-2.23.0 lib/avo/hosts/ordering.rb
avo-2.22.0 lib/avo/hosts/ordering.rb
avo-2.21.3.pre.pr1489 lib/avo/hosts/ordering.rb
avo-2.21.2.pre.pr1486 lib/avo/hosts/ordering.rb
avo-2.21.1.pre.pr1484 lib/avo/hosts/ordering.rb