Module: Ruport::Controller::Hooks::ClassMethods

Defined in:
lib/ruport/controller.rb

Instance Method Summary collapse

Instance Method Details

#controllerObject

The class of the controller object for the base class.

Example:

>> Ruport::Data::Table.controller
=> Ruport::Controller::Table


149
150
151
# File 'lib/ruport/controller.rb', line 149

def controller
  @controller
end

#rendering_optionsObject

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



115
116
117
# File 'lib/ruport/controller.rb', line 115

def rendering_options
  @rendering_options
end

#renders_as_group(options = {}) ⇒ Object

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



133
134
135
# File 'lib/ruport/controller.rb', line 133

def renders_as_group(options={})
  renders_with Ruport::Controller::Group,options
end

#renders_as_grouping(options = {}) ⇒ Object

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



139
140
141
# File 'lib/ruport/controller.rb', line 139

def renders_as_grouping(options={})
  renders_with Ruport::Controller::Grouping,options
end

#renders_as_row(options = {}) ⇒ Object

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



127
128
129
# File 'lib/ruport/controller.rb', line 127

def renders_as_row(options={})
  renders_with Ruport::Controller::Row, options
end

#renders_as_table(options = {}) ⇒ Object

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



121
122
123
# File 'lib/ruport/controller.rb', line 121

def renders_as_table(options={})
  renders_with Ruport::Controller::Table,options
end

#renders_with(controller, opts = {}) ⇒ Object

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

Usage:

class MyStructure
  include Controller::Hooks
  renders_with CustomController
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 Controller::Hooks
  renders_with CustomController, :font_size => 14
end


109
110
111
112
# File 'lib/ruport/controller.rb', line 109

def renders_with(controller,opts={})
  @controller = controller
  @rendering_options=opts
end