module Ruport::Formatter::RenderingTools

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

Public Instance Methods

render_group(group,options={},&block) click to toggle source

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.

# 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) click to toggle source

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.

# 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) click to toggle source

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

# 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) click to toggle source

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.

# 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) click to toggle source

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.

# File lib/ruport/formatter.rb, line 81
def render_table(table,options={},&block)
  render_helper(Controller::Table,table,options,&block)
end

Private Instance Methods

render_helper(rend_klass, source_data,options={},&block) click to toggle source
# File lib/ruport/formatter.rb, line 115
def render_helper(rend_klass, source_data,options={},&block)
  options = {:data => source_data, 
             :io => output,
             :layout => false }.merge(options)       
             
  options[:io] = "" if self.class.kind_of?(Ruport::Formatter::PDF)
  rend_klass.render(format,options) do |rend|
    block[rend] if block
  end
end