Class: Hoss::Transport::Filters::Container Private

Inherits:
Object
  • Object
show all
Defined in:
lib/hoss/transport/filters.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Container

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Container.



34
35
36
# File 'lib/hoss/transport/filters.rb', line 34

def initialize(config)
  @filters = { secrets: SecretsFilter.new(config) }
end

Instance Method Details

#add(key, filter) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



38
39
40
# File 'lib/hoss/transport/filters.rb', line 38

def add(key, filter)
  @filters = @filters.merge(key => filter)
end

#apply!(payload) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



46
47
48
49
50
51
52
# File 'lib/hoss/transport/filters.rb', line 46

def apply!(payload)
  @filters.reduce(payload) do |result, (_key, filter)|
    result = filter.call(result)
    break SKIP if result.nil?
    result
  end
end

#lengthObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



54
55
56
# File 'lib/hoss/transport/filters.rb', line 54

def length
  @filters.length
end

#remove(key) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



42
43
44
# File 'lib/hoss/transport/filters.rb', line 42

def remove(key)
  @filters.delete(key)
end