Class: Lotus::View::Rendering::LayoutFinder Private
- Inherits:
-
Object
- Object
- Lotus::View::Rendering::LayoutFinder
- Defined in:
- lib/lotus/view/rendering/layout_finder.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Defines the logic to find a layout
Constant Summary collapse
- SUFFIX =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Layout class name suffix
'Layout'.freeze
Class Method Summary collapse
-
.find(layout) ⇒ Lotus::Layout
private
Find a layout from the given name.
Instance Method Summary collapse
-
#find ⇒ Lotus::Layout
private
Find the layout for the view.
-
#initialize(view) ⇒ LayoutFinder
constructor
private
Initialize the finder.
Constructor Details
#initialize(view) ⇒ LayoutFinder
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initialize the finder
58 59 60 |
# File 'lib/lotus/view/rendering/layout_finder.rb', line 58 def initialize(view) @view = view end |
Class Method Details
.find(layout) ⇒ Lotus::Layout
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Find a layout from the given name.
42 43 44 45 46 47 48 49 50 |
# File 'lib/lotus/view/rendering/layout_finder.rb', line 42 def self.find(layout) case layout when Symbol, String class_name = "#{ Utils::String.new(layout).classify }#{ SUFFIX }" Object.const_get(class_name) when nil Lotus::View.layout end end |
Instance Method Details
#find ⇒ Lotus::Layout
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Find the layout for the view
98 99 100 |
# File 'lib/lotus/view/rendering/layout_finder.rb', line 98 def find self.class.find(@view.layout) end |