Class: Array
- Inherits:
-
Object
- Object
- Array
- Defined in:
- lib/cash/util/array.rb
Instance Method Summary collapse
Instance Method Details
#to_hash ⇒ Object
4 5 6 7 8 |
# File 'lib/cash/util/array.rb', line 4 def to_hash keys_and_values_without_nils = reject { |key, value| value.nil? } shallow_flattened_keys_and_values_without_nils = keys_and_values_without_nils.inject([]) { |result, pair| result += pair } Hash[*shallow_flattened_keys_and_values_without_nils] end |