From d362b7efaa4b7a9b3a0b84faf9c59673d16df591 Mon Sep 17 00:00:00 2001 From: Holger Just Date: Sat, 5 Aug 2017 23:19:23 +0200 Subject: [PATCH] Make Flow#unshift_filter the primary alias before filter_prepend to be more consistent --- lib/rackstash/flow.rb | 4 ++-- spec/rackstash/flow_spec.rb | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/rackstash/flow.rb b/lib/rackstash/flow.rb index 0d38c6b..c366bc5 100644 --- a/lib/rackstash/flow.rb +++ b/lib/rackstash/flow.rb @@ -166,11 +166,11 @@ module Rackstash end # (see FilterChain#unshift) - def filter_prepend(*filter, &block) + def filter_unshift(*filter, &block) @filter_chain.unshift(*filter, &block) self 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 # does not support reopening. This method is called by the logger's {Sink}. diff --git a/spec/rackstash/flow_spec.rb b/spec/rackstash/flow_spec.rb index ec45744..39f1965 100644 --- a/spec/rackstash/flow_spec.rb +++ b/spec/rackstash/flow_spec.rb @@ -213,18 +213,18 @@ describe Rackstash::Flow do end end - describe '#filter_prepend' do + describe '#filter_unshift' do it 'calls FilterChain#unshift' do expect(flow.filter_chain).to receive(:unshift).twice.and_call_original - expect(flow.filter_prepend ->(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_unshift { |event| event }).to equal flow expect(flow.filter_chain.size).to eql 2 end - it 'can use the #filter_unshift alias' do - expect(flow.method(:filter_unshift)).to eql flow.method(:filter_prepend) + it 'can use the #filter_prepend alias' do + expect(flow.method(:filter_prepend)).to eql flow.method(:filter_unshift) end end