Sha256: d3de3ac1bd5577b3f327a1ccb8f2965a90ac4af677254269111eb7fae944e287

Contents?: true

Size: 361 Bytes

Versions: 1

Compression:

Stored size: 361 Bytes

Contents

require_relative "../request"

class Skala::Adapter::Search::Request::SortRequest
  include Virtus.model

  class Order < Virtus::Attribute
    def coerce(value)
      value = value.try(:to_s).try(:downcase)
      ["asc", "desc"].include?(value) ? value : nil
    end
  end

  attribute :field, String, required: true
  attribute :order, Order,  lazy: true
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
skala-1.1.0 lib/skala/adapter/search/request/sort_request.rb