Class: Array
- Inherits:
-
Object
- Object
- Array
- Defined in:
- lib/cash/util/array.rb
Instance Method Summary collapse
Instance Method Details
#to_hash_without_nils ⇒ Object
4 5 6 7 8 |
# File 'lib/cash/util/array.rb', line 4 def to_hash_without_nils 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 |