Class: Saucy::Layouts
- Inherits:
-
Object
- Object
- Saucy::Layouts
- Defined in:
- lib/saucy/layouts.rb
Defined Under Namespace
Classes: Controller
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Layouts
constructor
A new instance of Layouts.
- #method_missing(controller_name, *args, &block) ⇒ Object
Constructor Details
#initialize ⇒ Layouts
Returns a new instance of Layouts.
3 4 5 |
# File 'lib/saucy/layouts.rb', line 3 def initialize @controllers = {} end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(controller_name, *args, &block) ⇒ Object
7 8 9 |
# File 'lib/saucy/layouts.rb', line 7 def method_missing(controller_name, *args, &block) @controllers[controller_name.to_s] ||= Controller.new end |
Class Method Details
.to_proc ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/saucy/layouts.rb', line 11 def self.to_proc lambda do |controller| controller_name = controller.controller_name action_name = controller.action_name Saucy::Configuration.layouts.send(controller_name).send(action_name) end end |