Class: Hash
Overview
class String
Instance Method Summary (collapse)
-
- (Object) +(add)
Add two hashes.
-
- (Object) <<(add)
Add two hashes.
Instance Method Details
- (Object) +(add)
Add two hashes. Does not overwrite pre-existing values.
113 114 115 116 117 118 |
# File 'lib/srs_game.rb', line 113 def +(add) temp = {} add.each { |k, v| temp[k] = v} self.each { |k, v| temp[k] = v} temp end |
- (Object) <<(add)
Add two hashes. Overwrites pre-existing values, and is destructive.
121 122 123 124 125 126 |
# File 'lib/srs_game.rb', line 121 def <<(add) temp = {} self.each { |k, v| temp[k] = v} add.each { |k,v| temp[k] = v} replace temp end |