lib/attr/gather/aggregators/base.rb in attr-gather-1.1.1 vs lib/attr/gather/aggregators/base.rb in attr-gather-1.1.2
- old
+ new
@@ -1,7 +1,9 @@
# frozen_string_literal: true
+require 'attr/gather/filters/noop'
+
module Attr
module Gather
module Aggregators
# @abstract Subclass and override {#call} to implement
# a custom Aggregator class.
@@ -9,11 +11,13 @@
# @!attribute [r] filter
# @return [Attr::Gather::Filters::Base] filter for the output data
class Base
attr_accessor :filter
+ NOOP_FILTER ||= Filters::Noop.new
+
def initialize(**opts)
- @filter = opts.delete(:filter)
+ @filter = opts.delete(:filter) || NOOP_FILTER
end
def call(_original_input, _results_array)
raise NotImplementedError
end