Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Commit

Permalink
Hash#keys_to_i! method
Browse files Browse the repository at this point in the history
  • Loading branch information
slntopp committed Apr 29, 2021
1 parent 4de7cac commit 16e0b5f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/std++/main.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@ def to_s!
self
end

# Converts all keys to Integer
# @return [Hash]
def keys_to_i!
self.keys.each do |key|
self[key.to_i] = self.delete key if key.class != Integer
end
self
end

# Returns array of values with given keys
# @param [Array] keys - Array of values
# @return [Array]
Expand Down

0 comments on commit 16e0b5f

Please sign in to comment.