Class: Hash
- Inherits:
-
Object
- Object
- Hash
- Defined in:
- lib/patches.rb
Direct Known Subclasses
Instance Method Summary collapse
Instance Method Details
#random_key ⇒ Object
3 4 5 6 7 8 |
# File 'lib/patches.rb', line 3 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
9 10 11 |
# File 'lib/patches.rb', line 9 def shuffle self.class[self.to_a.sample(self.length)] end |
#shuffle! ⇒ Object
13 14 15 |
# File 'lib/patches.rb', line 13 def shuffle! self.replace(self.shuffle) end |