Class: Forgery::Extensions::Array

Inherits:
Array
  • Object
show all
Defined in:
lib/forgery/extensions/array.rb

Instance Method Summary collapse

Instance Method Details

#randomObject

The only forgery extension that returns an extended object



10
11
12
# File 'lib/forgery/extensions/array.rb', line 10

def random
  Forgery::Extend(self[Kernel.rand(size)])
end

#random_subset(len = 2) ⇒ Object



14
15
16
17
18
# File 'lib/forgery/extensions/array.rb', line 14

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

#unextendObject



5
6
7
# File 'lib/forgery/extensions/array.rb', line 5

def unextend
  to_a
end