Class: ArtirixDataModels::AggregationsFactory::SortedBucketsAggregationClassFactory::SortedBucketAggregationBase
Constant Summary
Constants included
from Inspectable
Inspectable::SPACE
Instance Attribute Summary
#name
Class Method Summary
collapse
Instance Method Summary
collapse
#calculate_filtered, #data_hash, #filtered_buckets, #filtered_first_buckets, #initialize, #non_empty_buckets, #unfiltered_buckets
from_json, #initialize, #pretty_name
#data_hash_for_inspect, #inspect, #inspect_with_tab
Class Method Details
.sort_by_callable ⇒ Object
111
112
113
|
# File 'lib/artirix_data_models/aggregations_factory.rb', line 111
def self.sort_by_callable
@sort_by_callable
end
|
.sort_by_callable=(callable = nil, &block) ⇒ Object
115
116
117
118
119
|
# File 'lib/artirix_data_models/aggregations_factory.rb', line 115
def self.sort_by_callable=(callable = nil, &block)
raise ArgumentError unless callable || block
@sort_by_callable = callable || block
end
|
Instance Method Details
#buckets ⇒ Object
103
104
105
|
# File 'lib/artirix_data_models/aggregations_factory.rb', line 103
def buckets
@sorted_buckets ||= sort_buckets
end
|
#sort_buckets ⇒ Object
107
108
109
|
# File 'lib/artirix_data_models/aggregations_factory.rb', line 107
def sort_buckets
unordered_buckets.sort_by { |bucket| self.class.sort_by_callable.call(bucket) }
end
|
#unordered_buckets ⇒ Object
101
|
# File 'lib/artirix_data_models/aggregations_factory.rb', line 101
alias_method :unordered_buckets, :buckets
|