1
0
mirror of https://github.com/meineerde/rackstash.git synced 2025-10-17 14:01:01 +00:00

Add Fields::Array#push as an alias to #<<

This commit is contained in:
Holger Just 2017-04-06 22:58:50 +02:00
parent 7e452b630a
commit d9c7a2ad33
2 changed files with 7 additions and 0 deletions

View File

@ -85,6 +85,7 @@ module Rackstash
@raw << normalize(value)
self
end
alias push <<
# @return [::Array] deep-transforms the array into a plain Ruby Array
def as_json(*)

View File

@ -99,6 +99,12 @@ describe Rackstash::Fields::Array do
it 'returns the array' do
expect(array << 'value').to equal array
end
it 'can use push as an alias' do
expect(array.push 'value').to equal array
expect(array[0]).to eql 'value'
end
end
describe '#as_json' do