Sha256: 7cd89cd5b38d31b61614043c2221a38a022bb17d901d8d2512f7dc13ff372783

Contents?: true

Size: 493 Bytes

Versions: 43

Compression:

Stored size: 493 Bytes

Contents

module ForestAdminDatasourceToolkit
  module Validations
    class SortValidator
      def self.validate(collection, sort)
        sort&.each do |s|
          FieldValidator.validate(collection, s[:field])
          unless s[:ascending].is_a?(TrueClass) || s[:ascending].is_a?(FalseClass)
            raise ForestAdminDatasourceToolkit::Exceptions::ValidationError,
                  "Invalid sort_utils.ascending value: #{s[:ascending]}"
          end
        end
      end
    end
  end
end

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
forest_admin_datasource_toolkit-1.0.0.pre.beta.35 lib/forest_admin_datasource_toolkit/validations/sort_validator.rb
forest_admin_datasource_toolkit-1.0.0.pre.beta.34 lib/forest_admin_datasource_toolkit/validations/sort_validator.rb
forest_admin_datasource_toolkit-1.0.0.pre.beta.33 lib/forest_admin_datasource_toolkit/validations/sort_validator.rb