Sha256: 453a98667a24bb2a43fb37480cfa1ff361d9f90b39cea7e0035c798894d127f2

Contents?: true

Size: 551 Bytes

Versions: 114

Compression:

Stored size: 551 Bytes

Contents

# encoding: utf-8
require 'open_classes/object'
require 'open_classes/module'
require 'open_classes/array/together_helper'

# Array
class Array
  include TogetherHelper

  # Arrays bulk shuffle.
  #
  # together_shuffle has alias :tshuffle
  #
  #   lists = [[1, 2], [5, 6]]
  #   ret = lists.together_shuffle
  #   print ret # => [[1 or 2, 1 or 2], [5 or 6, 5 or 6]]
  def together_shuffle(count = nil)
    if_not_contain_array_rails_type_error
    reduce([]) { |ret, list|ret << list.shuffle }
  end

  alias_method :tshuffle, :together_shuffle
end

Version data entries

114 entries across 114 versions & 1 rubygems

Version Path
tbpgr_utils-0.0.151 lib/open_classes/array/together_shuffle.rb
tbpgr_utils-0.0.150 lib/open_classes/array/together_shuffle.rb
tbpgr_utils-0.0.149 lib/open_classes/array/together_shuffle.rb
tbpgr_utils-0.0.148 lib/open_classes/array/together_shuffle.rb
tbpgr_utils-0.0.147 lib/open_classes/array/together_shuffle.rb
tbpgr_utils-0.0.146 lib/open_classes/array/together_shuffle.rb
tbpgr_utils-0.0.145 lib/open_classes/array/together_shuffle.rb
tbpgr_utils-0.0.144 lib/open_classes/array/together_shuffle.rb
tbpgr_utils-0.0.143 lib/open_classes/array/together_shuffle.rb
tbpgr_utils-0.0.142 lib/open_classes/array/together_shuffle.rb
tbpgr_utils-0.0.141 lib/open_classes/array/together_shuffle.rb
tbpgr_utils-0.0.140 lib/open_classes/array/together_shuffle.rb
tbpgr_utils-0.0.139 lib/open_classes/array/together_shuffle.rb
tbpgr_utils-0.0.138 lib/open_classes/array/together_shuffle.rb
tbpgr_utils-0.0.137 lib/open_classes/array/together_shuffle.rb
tbpgr_utils-0.0.136 lib/open_classes/array/together_shuffle.rb
tbpgr_utils-0.0.135 lib/open_classes/array/together_shuffle.rb
tbpgr_utils-0.0.134 lib/open_classes/array/together_shuffle.rb
tbpgr_utils-0.0.133 lib/open_classes/array/together_shuffle.rb
tbpgr_utils-0.0.132 lib/open_classes/array/together_shuffle.rb