Ruport::Renderer::Hooks::ClassMethods

Public Instance Methods

renderer() click to toggle source

The class of the renderer object for the base class.

Example:

>> Ruport::Data::Table.renderer
=> Ruport::Renderer::Table
# File lib/ruport/renderer.rb, line 144
def renderer
  return unless @renderer
  @renderer.split("::").inject(Class) { |c,el| c.const_get(el) }
end
rendering_options() click to toggle source

The default rendering options for a class, stored as a hash.

# File lib/ruport/renderer.rb, line 110
def rendering_options
  @rendering_options
end
renders_as_group(options={}) click to toggle source

Shortcut for renders_with(Ruport::Renderer::Group), you may wish to override this if you build a custom group renderer.

# File lib/ruport/renderer.rb, line 128
def renders_as_group(options={})
  renders_with Ruport::Renderer::Group,options
end
renders_as_grouping(options={}) click to toggle source

Shortcut for renders_with(Ruport::Renderer::Grouping), you may wish to override this if you build a custom grouping renderer.

# File lib/ruport/renderer.rb, line 134
def renders_as_grouping(options={})
  renders_with Ruport::Renderer::Grouping,options
end
renders_as_row(options={}) click to toggle source

Shortcut for renders_with(Ruport::Renderer::Row), you may wish to override this if you build a custom row renderer.

# File lib/ruport/renderer.rb, line 122
def renders_as_row(options={})
  renders_with Ruport::Renderer::Row, options
end
renders_as_table(options={}) click to toggle source

Shortcut for renders_with(Ruport::Renderer::Table), you may wish to override this if you build a custom table renderer.

# File lib/ruport/renderer.rb, line 116
def renders_as_table(options={})
  renders_with Ruport::Renderer::Table,options
end
renders_with(renderer,opts={}) click to toggle source

Tells the class which renderer as() will forward to.

Usage:

class MyStructure
  include Renderer::Hooks
  renders_with CustomRenderer
end

You can also specify default rendering options, which will be used if they are not overriden by the options passed to as().

class MyStructure
  include Renderer::Hooks
  renders_with CustomRenderer, :font_size => 14
end
# File lib/ruport/renderer.rb, line 104
def renders_with(renderer,opts={})
  @renderer = renderer.name
  @rendering_options=opts
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.