Module: Ruport::Formatter::RenderingTools

Included in:
Ruport::Formatter
Defined in:
lib/ruport/formatter.rb

Overview

Provides shortcuts so that you can use Ruport’s default rendering capabilities within your custom formatters

Instance Method Summary collapse

Instance Method Details

#render_group(group, options = {}, &block) ⇒ Object

Uses Controller::Group to render the Group object with the given options.

Sets the :io attribute by default to the existing formatter’s output object.



90
91
92
# File 'lib/ruport/formatter.rb', line 90

def render_group(group,options={},&block)
  render_helper(Controller::Group,group,options,&block)
end

#render_grouping(grouping, options = {}, &block) ⇒ Object

Uses Controller::Grouping to render the Grouping object with the given options.

Sets the :io attribute by default to the existing formatter’s output object.



99
100
101
# File 'lib/ruport/formatter.rb', line 99

def render_grouping(grouping,options={},&block)
  render_helper(Controller::Grouping,grouping,options,&block)
end

#render_inline_grouping(options = {}, &block) ⇒ Object

Iterates through the data in the grouping and renders each group followed by a newline.



106
107
108
109
110
111
# File 'lib/ruport/formatter.rb', line 106

def render_inline_grouping(options={},&block)
  data.each do |_,group|
    render_group(group, options, &block)
    output << "\n"
  end
end

#render_row(row, options = {}, &block) ⇒ Object

Uses Controller::Row to render the Row object with the given options.

Sets the :io attribute by default to the existing formatter’s output object.



72
73
74
# File 'lib/ruport/formatter.rb', line 72

def render_row(row,options={},&block)
  render_helper(Controller::Row,row,options,&block)
end

#render_table(table, options = {}, &block) ⇒ Object

Uses Controller::Table to render the Table object with the given options.

Sets the :io attribute by default to the existing formatter’s output object.



81
82
83
# File 'lib/ruport/formatter.rb', line 81

def render_table(table,options={},&block)
  render_helper(Controller::Table,table,options,&block)
end