Class: Forgery::Extensions::Array

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

Instance Method Summary (collapse)

Instance Method Details

- (Object) random

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

- (Object) random_subset(len = 2)



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

- (Object) unextend



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

def unextend
  to_a
end