Sha256: 4f96f8b74b0db2cd6a3f9593969cda063b51e9422cec86fd44b3157a331f2e8f
Contents?: true
Size: 753 Bytes
Versions: 23
Compression:
Stored size: 753 Bytes
Contents
require 'config_builder/filter' module ConfigBuilder class FilterStack def initialize @filter_stack = [] end # @param input [Hash] # # @return [Hash] def filter(input) set_filters(input.delete(:filters)) output = @filter_stack.inject(input) do |current_input, filter| filter.set_config(current_input) filter.run end output end private # @note The implementation of this method is not final, use at your own peril. # @api private def set_filters(list) if list.nil? @filter_stack << ConfigBuilder::Filter::Roles.new @filter_stack << ConfigBuilder::Filter::Boxes.new else @filter_stack = list end end end end
Version data entries
23 entries across 23 versions & 2 rubygems