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, namespace = Object) ⇒ 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
82 83 84 |
# File 'lib/lotus/view/rendering/layout_finder.rb', line 82 def initialize(view) @view = view end |
Class Method Details
.find(layout, namespace = Object) ⇒ 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.
64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/lotus/view/rendering/layout_finder.rb', line 64 def self.find(layout, namespace = Object) case layout when Symbol, String # TODO Move this low level logic into a Lotus::Utils solution class_name = "#{ Utils::String.new(layout).classify }#{ SUFFIX }" namespace = Utils::Class.load_from_pattern!(namespace) namespace.const_get(class_name) when Class layout end || NullLayout 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
122 123 124 |
# File 'lib/lotus/view/rendering/layout_finder.rb', line 122 def find self.class.find(@view.layout) end |