Sha256: 209c77672a1d847c096f81ef77818a84387e134563a220dfc01446badbe5ab9a
Contents?: true
Size: 436 Bytes
Versions: 3
Compression:
Stored size: 436 Bytes
Contents
# encoding: utf-8 require 'attr_enumerable/attr_enumerable_helper' # AttrEnumerable module AttrEnumerable private def shuffle_attr(attribute, method_name, *args, &block) col = collection count = args.size == 0 ? 1 : Integer(args.first) fail ArgumentError, "invalid attribute #{attribute}" unless include_attr?(col.first, attribute) attrs = col.map { |e|e.send(attribute) } attrs.shuffle end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
tbpgr_utils-0.0.151 | lib/attr_enumerable/shuffle_attr.rb |
tbpgr_utils-0.0.150 | lib/attr_enumerable/shuffle_attr.rb |
tbpgr_utils-0.0.149 | lib/attr_enumerable/shuffle_attr.rb |