Class: Misc::BucketOrder

Inherits:
Object
  • Object
show all
Includes:
AttributesReader
Defined in:
lib/misc/bucket_order.rb

Overview

Aggregations::Buckets ordering strategy.

Instance Method Summary collapse

Methods included from AttributesReader

#attributes

Constructor Details

#initialize(field:, order: Enums::SortOrders.desc) ⇒ BucketOrder

Returns a new instance of BucketOrder.

Parameters:

  • field (String|Symbol)
  • order (Enums::SortOrders) (defaults to: Enums::SortOrders.desc)

    : Enums::SortOrders.(desc|asc), defaults to Enums::SortOrders.desc



11
12
13
14
# File 'lib/misc/bucket_order.rb', line 11

def initialize(field:, order: Enums::SortOrders.desc)
  @field = field.intern
  @order = order
end

Instance Method Details

#settingsObject

return [Hash]



17
18
19
# File 'lib/misc/bucket_order.rb', line 17

def settings
  {@field => @order.sort_order}
end