Class Array
In: lib/core_extensions.rb
Parent: Object

Methods

to_hash  

Public Instance methods

Convert array to hash by converting indices to keys. Example:

  ['hello', 'world'].to_hash # produces {0 => 'hello', 1 => 'world'}

[Source]

# File lib/core_extensions.rb, line 64
    def to_hash
        result = {}

        self.each_index do |index|
            result[index] = self[index]
        end

        result
    end

[Validate]