Sha256: 40c854b6c98bbc059469da2932a396cb5c114eecdedcbae4258ebdb0bec11eb9
Contents?: true
Size: 834 Bytes
Versions: 3
Compression:
Stored size: 834 Bytes
Contents
# frozen_string_literal: true module Attr module Gather module Aggregators # @abstract Subclass and override {#call} to implement # a custom Aggregator class. # # @!attribute [r] filter # @return [Attr::Gather::Filters::Base] filter for the output data class Base attr_accessor :filter def initialize(**opts) @filter = opts.delete(:filter) end def call(_original_input, _results_array) raise NotImplementedError end private def wrap_result(result) Concurrent::Promise.fulfill(result) end def unwrap_result(res) unvalidated = res.result.value! return unvalidated if filter.nil? filter.call(unvalidated).value end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
attr-gather-1.1.1 | lib/attr/gather/aggregators/base.rb |
attr-gather-1.1.0 | lib/attr/gather/aggregators/base.rb |
attr-gather-1.0.0 | lib/attr/gather/aggregators/base.rb |