1
0
mirror of https://github.com/meineerde/rackstash.git synced 2026-03-10 11:03:05 +00:00

Provide prepend alias for FilterChain@unshift

Ruby 2.5 introduces this alias for all arrays.
This commit is contained in:
Holger Just 2017-12-20 21:28:12 +01:00
parent 43a303b09d
commit 6bfe8ecb25
2 changed files with 6 additions and 0 deletions

View File

@ -251,6 +251,7 @@ module Rackstash
end end
self self
end end
alias prepend unshift
# Returns an Array representation of the filter chain. # Returns an Array representation of the filter chain.
# #

View File

@ -455,6 +455,11 @@ describe Rackstash::FilterChain do
expect { filter_chain.unshift }.to raise_error ArgumentError expect { filter_chain.unshift }.to raise_error ArgumentError
end end
it 'can use #prepend alias' do
filter_chain.prepend filter
expect(filter_chain[0]).to eql filter
end
end end
describe '#to_a' do describe '#to_a' do