Module: Ruport::Controller::Hooks::ClassMethods
- Defined in:
- lib/ruport/controller.rb
Instance Method Summary collapse
-
#controller ⇒ Object
The class of the controller object for the base class.
-
#rendering_options ⇒ Object
The default rendering options for a class, stored as a hash.
-
#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.
-
#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.
-
#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.
-
#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.
-
#renders_with(controller, opts = {}) ⇒ Object
Tells the class which controller as() will forward to.
Instance Method Details
#controller ⇒ Object
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_options ⇒ Object
The default rendering options for a class, stored as a hash.
115 116 117 |
# File 'lib/ruport/controller.rb', line 115 def @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(={}) renders_with Ruport::Controller::Group, 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(={}) renders_with Ruport::Controller::Grouping, 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(={}) renders_with Ruport::Controller::Row, 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(={}) renders_with Ruport::Controller::Table, 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 |