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:
parent
7c0c983dc2
commit
d26858c103
@ -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`.
|
||||||
|
|||||||
@ -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
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user