Sha256: ae884b49efd87d1c44e940121e735b3f40a0ae48a0f7d6759ac3522522a7e939

Contents?: true

Size: 496 Bytes

Versions: 1

Compression:

Stored size: 496 Bytes

Contents

require_relative "../request"

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

  attribute :exclude, Axiom::Types::Boolean, default: false

  # unless given, interfere the query type from the class name
  attribute :type, String, default: -> (instance, _) do
    query_name = instance.class.to_s.demodulize.underscore

    if (splitted_query_name = query_name.split("_")).last == "query"
      splitted_query_name[0..-2].join("_")
    else
      query_name
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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