1
0
mirror of https://github.com/meineerde/rackstash.git synced 2025-12-19 15:01:12 +00:00

Add Rackstash::Fields::Array#size as an alias to length

This commit is contained in:
Holger Just 2017-06-22 23:00:51 +02:00
parent 7c0c983dc2
commit d26858c103
2 changed files with 7 additions and 0 deletions

View File

@ -126,6 +126,7 @@ module Rackstash
def length def length
@raw.length @raw.length
end end
alias size length
# Set Union -- Add value from `array` to `self` excluding any duplicates # Set Union -- Add value from `array` to `self` excluding any duplicates
# and preserving the order from `self`. # and preserving the order from `self`.

View File

@ -228,6 +228,12 @@ describe Rackstash::Fields::Array do
array.clear array.clear
expect(array.length).to eql 0 expect(array.length).to eql 0
end end
it 'can use size as an alias' do
expect(array.size).to eql 0
array[0] = 'first'
expect(array.size).to eql 1
end
end end
describe '#merge' do describe '#merge' do