Minor refactor - Uses Enumerable#to_a instead of iterate and add to an
array
This commit is contained in:
parent
4236d8f056
commit
7ed8934f08
@ -31,9 +31,7 @@ def in_groups_of(number, fill_with = nil)
|
||||
if block_given?
|
||||
collection.each_slice(number) { |slice| yield(slice) }
|
||||
else
|
||||
groups = []
|
||||
collection.each_slice(number) { |group| groups << group }
|
||||
groups
|
||||
collection.each_slice(number).to_a
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -119,7 +119,7 @@ def change(options)
|
||||
options.fetch(:day, day)
|
||||
)
|
||||
end
|
||||
|
||||
|
||||
# Allow Date to be compared with Time by converting to DateTime and relying on the <=> from there.
|
||||
def compare_with_coercion(other)
|
||||
if other.is_a?(Time)
|
||||
|
@ -235,7 +235,6 @@ def process_array(value)
|
||||
value.map! { |i| deep_to_h(i) }
|
||||
value.length > 1 ? value : value.first
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user