Class: Hirb::Helpers::AutoTable

### Home Classes Methods

### In Files

- lib/hirb/helpers/auto_table.rb

### Parent

Hirb::Helpers::Table

### Methods

- ::render

### Files

- LICENSE.txt
- README.rdoc

### Class/Module Index

Quicksearch

- Hirb
- Hirb::Console
- Hirb::DynamicView
- Hirb::Formatter
- Hirb::Helpers
- Hirb::Helpers::AutoTable
- Hirb::Helpers::ObjectTable
- Hirb::Helpers::ParentChildTree
- Hirb::Helpers::Table
- Hirb::Helpers::Table::Filters
- Hirb::Helpers::Table::Resizer
- Hirb::Helpers::Table::TooManyFieldsForWidthError
- Hirb::Helpers::Tree
- Hirb::Helpers::Tree::Node
- Hirb::Helpers::Tree::Node::MissingLevelError
- Hirb::Helpers::Tree::Node::MissingValueError
- Hirb::Helpers::Tree::ParentlessNodeError
- Hirb::Helpers::VerticalTable
- Hirb::Menu
- Hirb::Menu::Error
- Hirb::ObjectMethods
- Hirb::Pager
- Hirb::String
- Hirb::Util
- Hirb::View
- Hirb::Views

No matching classes.

# Hirb::Helpers::AutoTable

This helper wraps around the other table helpers i.e. Hirb::Helpers::Table while providing default helper options via Hirb::DynamicView. Using these default options, this helper supports views for the following modules/classes: ActiveRecord::Base, CouchFoo::Base, CouchPotato::Persistence, CouchRest::ExtendedDocument, DBI::Row, DataMapper::Resource, Friendly::Document, MongoMapper::Document, MongoMapper::EmbeddedDocument, Mongoid::Document, Ripple::Document, Sequel::Model.

### Public Class Methods

render(output, options={}) click to toggle source

Takes same options as Hirb::Helpers::Table.render except as noted below.

#### Options:

:table_class

  Explicit table class to use for rendering. Defaults to Hirb::Helpers::ObjectTable if output is not an Array or Hash. Otherwise defaults to Hirb::Helpers::Table.

    # File lib/hirb/helpers/auto_table.rb, line 16
    def self.render(output, options={})
      output = Array(output)
      (defaults = dynamic_options(output[0])) && (options = defaults.merge(options))
      klass = options.delete(:table_class) || (
        !(output[0].is_a?(Hash) || output[0].is_a?(Array)) ?
        Hirb::Helpers::ObjectTable : Hirb::Helpers::Table)
      klass.render(output, options)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.