Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Changed variable names for in_groups_of to make more obvious

  • Loading branch information...
commit 55902dede224574b953411d146f0f8639e8d97c9 1 parent d7bd01f
@aussiegeek aussiegeek authored
Showing with 6 additions and 6 deletions.
  1. +6 −6 activesupport/lib/active_support/core_ext/array/grouping.rb
View
12 activesupport/lib/active_support/core_ext/array/grouping.rb
@@ -7,16 +7,16 @@ module Grouping
# Splits or iterates over the array in groups of size +number+,
# padding any remaining slots with +fill_with+ unless it is +false+.
#
- # %w(1 2 3 4 5 6 7).in_groups_of(3) {|g| p g}
+ # %w(1 2 3 4 5 6 7).in_groups_of(3) {|group| p group}
# ["1", "2", "3"]
# ["4", "5", "6"]
# ["7", nil, nil]
#
- # %w(1 2 3).in_groups_of(2, ' ') {|g| p g}
+ # %w(1 2 3).in_groups_of(2, ' ') {|group| p group}
# ["1", "2"]
# ["3", " "]
#
- # %w(1 2 3).in_groups_of(2, false) {|g| p g}
+ # %w(1 2 3).in_groups_of(2, false) {|group| p group}
# ["1", "2"]
# ["3"]
def in_groups_of(number, fill_with = nil)
@@ -42,17 +42,17 @@ def in_groups_of(number, fill_with = nil)
# Splits or iterates over the array in +number+ of groups, padding any
# remaining slots with +fill_with+ unless it is +false+.
#
- # %w(1 2 3 4 5 6 7 8 9 10).in_groups(3) {|g| p g}
+ # %w(1 2 3 4 5 6 7 8 9 10).in_groups(3) {|group| p group}
# ["1", "2", "3", "4"]
# ["5", "6", "7", nil]
# ["8", "9", "10", nil]
#
- # %w(1 2 3 4 5 6 7).in_groups(3, ' ') {|g| p g}
+ # %w(1 2 3 4 5 6 7).in_groups(3, ' ') {|group| p group}
# ["1", "2", "3"]
# ["4", "5", " "]
# ["6", "7", " "]
#
- # %w(1 2 3 4 5 6 7).in_groups(3, false) {|g| p g}
+ # %w(1 2 3 4 5 6 7).in_groups(3, false) {|group| p group}
# ["1", "2", "3"]
# ["4", "5"]
# ["6", "7"]
Please sign in to comment.
Something went wrong with that request. Please try again.