Class: Hirb::Helpers::ObjectTable

### Home Classes Methods

### In Files

- lib/hirb/helpers/object_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::ObjectTable

### Public Class Methods

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

Rows are any ruby objects. Takes same options as Hirb::Helpers::Table.render except as noted below.

#### Options:

:fields

  Methods of the object to represent as columns. Defaults to [:to_s].

    # File lib/hirb/helpers/object_table.rb, line 6
    def self.render(rows, options ={})
      options[:fields] ||= [:to_s]
      options[:headers] ||= {:to_s=>'value'} if options[:fields] == [:to_s]
      item_hashes = options[:fields].empty? ? [] : Array(rows).inject([]) {|t,item|
        t << options[:fields].inject({}) {|h,f| h[f] = item.send(f); h}
      }
      super(item_hashes, options)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.