Module: Hirb::Console

### Home Classes Methods

### In Files

- lib/hirb/console.rb

### Methods

- ::format_output
- ::render_output
- #menu
- #table
- #view

### 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::Console

This module is meant to be extended to provide methods for use in a console/irb shell. For example:

    >> extend Hirb::Console
    >> view 'some string', :class=>Some::String::Formatter
    >> table [[:row1], [:row2]]

### Public Class Methods

format_output(output, options={}, &block) click to toggle source

Takes same arguments and options as render_output() but returns formatted output instead of rendering it.

    # File lib/hirb/console.rb, line 22
    def format_output(output, options={}, &block)
      View.load_config unless View.config_loaded?
      View.formatter.format_output(output, options.merge(:console=>true), &block)
    end

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

A console version of render_output() which takes its same options but allows for shorthand. All options are passed to the helper except for the formatter options. Formatter options are :class, :method and :output_method. Examples:

    render_output output, :class=>:tree :type=>:directory
    # is the same as:
    render_output output, :class=>:tree, :options=> {:type=>:directory}

    # File lib/hirb/console.rb, line 16
    def render_output(output, options={})
      View.load_config unless View.config_loaded?
      View.render_output(output, options.merge(:console=>true))
    end

### Public Instance Methods

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

Renders a table for the given object. Takes same options as Hirb::Helpers::Table.render.

    # File lib/hirb/console.rb, line 29
    def table(output, options={})
      Console.render_output(output, options.merge(:class=>"Hirb::Helpers::AutoTable"))
    end

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

Renders any specified view for the given object. Takes same options as Hirb::View.render_output.

    # File lib/hirb/console.rb, line 34
    def view(output, options={})
      Console.render_output(output, options)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.