Class: SimplyGenius::Atmos::PluginManager::OutputFilterCollection

Inherits:
Object
  • Object
show all
Includes:
GemLogger::LoggerSupport
Defined in:
lib/simplygenius/atmos/plugin_manager.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filters) ⇒ OutputFilterCollection

Returns a new instance of OutputFilterCollection.



89
90
91
# File 'lib/simplygenius/atmos/plugin_manager.rb', line 89

def initialize(filters)
  @filters = filters
end

Instance Attribute Details

#filtersObject

Returns the value of attribute filters.



87
88
89
# File 'lib/simplygenius/atmos/plugin_manager.rb', line 87

def filters
  @filters
end

Instance Method Details

#closeObject



106
107
108
109
110
111
112
113
114
# File 'lib/simplygenius/atmos/plugin_manager.rb', line 106

def close
  @filters.each do |f|
    begin
      f.close
    rescue StandardError => e
      logger.log_exception e, "Output filter failed during close: #{f.class}"
    end
  end
end

#filter_blockObject



93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/simplygenius/atmos/plugin_manager.rb', line 93

def filter_block
  return Proc.new do |data, flushing: false|
    @filters.inject(data) do |memo, obj|
      begin
        obj.filter(memo, flushing: flushing)
      rescue StandardError => e
        logger.log_exception e, "Output filter failed during filter: #{obj.class}"
        memo
      end
    end
  end
end