Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/patches.rb

Direct Known Subclasses

KAG::Data, KAG::Help::Book, KAG::Stats::Main

Instance Method Summary collapse

Instance Method Details

#random_keyObject



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

#shuffleObject



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