mirror of
https://github.com/meineerde/rackstash.git
synced 2025-12-20 15:21:12 +00:00
Add Fields::Array#push as an alias to #<<
This commit is contained in:
parent
7e452b630a
commit
d9c7a2ad33
@ -85,6 +85,7 @@ module Rackstash
|
|||||||
@raw << normalize(value)
|
@raw << normalize(value)
|
||||||
self
|
self
|
||||||
end
|
end
|
||||||
|
alias push <<
|
||||||
|
|
||||||
# @return [::Array] deep-transforms the array into a plain Ruby Array
|
# @return [::Array] deep-transforms the array into a plain Ruby Array
|
||||||
def as_json(*)
|
def as_json(*)
|
||||||
|
|||||||
@ -99,6 +99,12 @@ describe Rackstash::Fields::Array do
|
|||||||
it 'returns the array' do
|
it 'returns the array' do
|
||||||
expect(array << 'value').to equal array
|
expect(array << 'value').to equal array
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'can use push as an alias' do
|
||||||
|
expect(array.push 'value').to equal array
|
||||||
|
expect(array[0]).to eql 'value'
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#as_json' do
|
describe '#as_json' do
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user