Class: Array

### Home Classes Methods

### In Files

- lib/assistance/extract_options.rb

### Parent

Object

### Methods

- #extract_options!

### Files

- CHANGELOG
- COPYING
- README

### Class/Module Index

Quicksearch

- Validation
- Validation::ClassMethods
- Validation::Errors
- Validation::Generator
- Assistance
- Assistance::TimeCalculations
- Inflector
- Inflector::Inflections
- Array
- ConnectionPool
- FalseClass
- NilClass
- Numeric
- Object
- SingleThreadedPool
- String
- TrueClass

No matching classes.

# Array

Array extensions

### Public Instance Methods

extract_options!() click to toggle source

Removes and returns the last member of the array if it is a hash. Otherwise, an empty hash is returned This method is useful when writing methods that take an options hash as the last parameter. For example:

    def validate_each(*args, &block)
      opts = args.extract_options!
      ...
    end

    # File lib/assistance/extract_options.rb, line 11
    def extract_options!
      last.is_a?(Hash) ? pop : {}
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.