Skip to content

Commit e2f3615

Browse files
committed
Optimize _map_collection
1 parent 9836f59 commit e2f3615

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

lib/jbuilder.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -344,9 +344,11 @@ def _set_value(key, value)
344344
end
345345

346346
def _map_collection(collection)
347-
collection.map do |element|
347+
collection = collection.map do |element|
348348
_scope{ yield element }
349-
end - [BLANK]
349+
end
350+
collection.delete(BLANK)
351+
collection
350352
end
351353

352354
def _scope

0 commit comments

Comments
 (0)