mirror of
https://github.com/meineerde/rackstash.git
synced 2025-12-19 15:01:12 +00:00
Make Flow#unshift_filter the primary alias before filter_prepend to be more consistent
This commit is contained in:
parent
581b8b1819
commit
d362b7efaa
@ -166,11 +166,11 @@ module Rackstash
|
|||||||
end
|
end
|
||||||
|
|
||||||
# (see FilterChain#unshift)
|
# (see FilterChain#unshift)
|
||||||
def filter_prepend(*filter, &block)
|
def filter_unshift(*filter, &block)
|
||||||
@filter_chain.unshift(*filter, &block)
|
@filter_chain.unshift(*filter, &block)
|
||||||
self
|
self
|
||||||
end
|
end
|
||||||
alias filter_unshift filter_prepend
|
alias filter_prepend filter_unshift
|
||||||
|
|
||||||
# Re-open the log adapter if supported. This might be a no-op if the adapter
|
# Re-open the log adapter if supported. This might be a no-op if the adapter
|
||||||
# does not support reopening. This method is called by the logger's {Sink}.
|
# does not support reopening. This method is called by the logger's {Sink}.
|
||||||
|
|||||||
@ -213,18 +213,18 @@ describe Rackstash::Flow do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#filter_prepend' do
|
describe '#filter_unshift' do
|
||||||
it 'calls FilterChain#unshift' do
|
it 'calls FilterChain#unshift' do
|
||||||
expect(flow.filter_chain).to receive(:unshift).twice.and_call_original
|
expect(flow.filter_chain).to receive(:unshift).twice.and_call_original
|
||||||
|
|
||||||
expect(flow.filter_prepend ->(event) { event }).to equal flow
|
expect(flow.filter_unshift ->(event) { event }).to equal flow
|
||||||
expect(flow.filter_prepend { |event| event }).to equal flow
|
expect(flow.filter_unshift { |event| event }).to equal flow
|
||||||
|
|
||||||
expect(flow.filter_chain.size).to eql 2
|
expect(flow.filter_chain.size).to eql 2
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'can use the #filter_unshift alias' do
|
it 'can use the #filter_prepend alias' do
|
||||||
expect(flow.method(:filter_unshift)).to eql flow.method(:filter_prepend)
|
expect(flow.method(:filter_prepend)).to eql flow.method(:filter_unshift)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user