Class: Caoutsearch::Response::Aggregations
- Defined in:
- lib/caoutsearch/response/aggregations.rb
Instance Method Summary collapse
- #custom_reader(key) ⇒ Object (also: #[])
- #has_transformation?(key) ⇒ Boolean
-
#initialize(aggs, search = nil, &block) ⇒ Aggregations
constructor
A new instance of Aggregations.
- #key?(key) ⇒ Boolean
Constructor Details
#initialize(aggs, search = nil, &block) ⇒ Aggregations
Returns a new instance of Aggregations.
8 9 10 11 |
# File 'lib/caoutsearch/response/aggregations.rb', line 8 def initialize(aggs, search = nil, &block) @source_search = search super(aggs, &block) end |
Instance Method Details
#custom_reader(key) ⇒ Object Also known as: []
17 18 19 20 21 22 23 24 25 |
# File 'lib/caoutsearch/response/aggregations.rb', line 17 def custom_reader(key) if has_transformation?(key) transformation_cache(key) do call_transformation(key) end else super end end |
#has_transformation?(key) ⇒ Boolean
29 30 31 |
# File 'lib/caoutsearch/response/aggregations.rb', line 29 def has_transformation?(key) @source_search&.class&.transformations&.include?(key.to_s) end |
#key?(key) ⇒ Boolean
13 14 15 |
# File 'lib/caoutsearch/response/aggregations.rb', line 13 def key?(key) super || has_transformation?(key) end |