Sha256: c79ee871e91c2e5575d043e93c623ef0521c90515bc6ac898505bf8632b0239b

Contents?: true

Size: 370 Bytes

Versions: 9

Compression:

Stored size: 370 Bytes

Contents

class Forgery
  module Extensions
    class Array < ::Array

      def unextend
        to_a
      end

      # The only forgery extension that returns an extended object
      def random
        Forgery::Extend(self[Kernel.rand(size)])
      end

      def random_subset(len=2)
        rs = []
        len.times { rs << random }
        rs
      end

    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
forgery-0.8.1 lib/forgery/extensions/array.rb
forgery-0.7.0 lib/forgery/extensions/array.rb
forgery-0.6.0 lib/forgery/extensions/array.rb
forgery-0.5.0 lib/forgery/extensions/array.rb
forgery-0.4.4 lib/forgery/extensions/array.rb
forgery-0.4.3 lib/forgery/extensions/array.rb
forgery-0.4.2 lib/forgery/extensions/array.rb
forgery-0.4.1 lib/forgery/extensions/array.rb
forgery-0.4.0 lib/forgery/extensions/array.rb