Class: Array

### Home Classes Methods

### In Files

- lib/extlib/array.rb

### Parent

Object

### Methods

- #to_hash
- #to_mash

### Files

- LICENSE
- README.rdoc

### Class/Module Index

Quicksearch

- Extlib
- Extlib::Assertions
- Extlib::ByteArray
- Extlib::Hook
- Extlib::Hook::ClassMethods
- Extlib::Inflection
- Extlib::LocalObjectSpace
- Extlib::Logger
- Extlib::Pooling
- Extlib::Pooling::InvalidResourceError
- Extlib::Pooling::Pool
- Extlib::SimpleSet
- Gem
- Gem::SourceIndex
- Gem::Specification
- LazyModule
- LazyModule::ClassMethods
- Array
- Class
- DateTime
- Dictionary
- FalseClass
- Hash
- LazyArray
- Mash
- Module
- NilClass
- Numeric
- Object
- ObjectSpace
- Pathname
- REXMLUtilityNode
- String
- Struct
- Symbol
- Time
- ToHashParser
- TrueClass
- VirtualFile

No matching classes.

# Array

### Public Instance Methods

to_hash() click to toggle source

Transforms an Array of key/value pairs into a Hash

This is a better idiom than using Hash in Ruby 1.8.6 because it is not possible to limit the flattening to a single level.

@return [Hash]

    A Hash where each entry in the Array is turned into a key/value

@api public

    # File lib/extlib/array.rb, line 16
    def to_hash
      h = {}
      each { |k,v| h[k] = v }
      h
    end

to_mash() click to toggle source

Transforms an Array of key/value pairs into a Mash

This is a better idiom than using Mash in Ruby 1.8.6 because it is not possible to limit the flattening to a single level.

@return [Mash]

    A Hash where each entry in the Array is turned into a key/value

@api public

    # File lib/extlib/array.rb, line 33
    def to_mash
      m = Mash.new
      each { |k,v| m[k] = v }
      m
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.