Class: HashMap
- Inherits:
-
Object
- Object
- HashMap
- Defined in:
- lib/utils/hash_map.rb
Overview
author: Dominik Richter author: Christoph Hartmann
Class Method Summary collapse
Class Method Details
.[](hash, *keys) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/utils/hash_map.rb', line 7 def [](hash, *keys) return hash if keys.empty? || hash.nil? key = keys.shift if hash.is_a?(Array) map = hash.map { |i| [i, key] } else map = hash[key] end [map, *keys] rescue NoMethodError => _ nil end |