Class: Hash
- Inherits:
-
Object
show all
- Defined in:
- lib/patches.rb
Instance Method Summary
collapse
Instance Method Details
#random_key ⇒ Object
5
6
7
8
9
10
|
# File 'lib/patches.rb', line 5
def random_key
@keys_not_used = self.dup if (!@keys_not_used or @keys_not_used.size == 0)
key = @keys_not_used.keys[rand(@keys_not_used.size)]
@keys_not_used.delete(key)
key
end
|
#shuffle ⇒ Object
11
12
13
|
# File 'lib/patches.rb', line 11
def shuffle
self.class[self.to_a.sample(self.length)]
end
|
#shuffle! ⇒ Object
15
16
17
|
# File 'lib/patches.rb', line 15
def shuffle!
self.replace(self.shuffle)
end
|