lib/lotus/view/dsl.rb
def layout(value = nil)
        if value.nil?
          @_layout ||= Rendering::LayoutFinder.find(@layout || configuration.layout, configuration.namespace)
        elsif !value
          @layout = Lotus::View::Rendering::NullLayout
        else
          @layout = value
        end
      end
# When a value is given, it specifies the layout.
# When false is given, Lotus::View::Rendering::NullLayout is returned.
# Otherwise, it returns the previously specified layout.
#
# When the global configuration is set (`Lotus::View.layout=`), after the
# loading process, it will return that layout if not otherwise specified.
#
# @param value [Symbol, FalseClass, nil] the layout name
#
# @return [Symbol, nil] the specified layout for this view, if set
#
# @since 0.1.0
#
# @see Lotus::Layout
#
# @example Default usage
#   require 'lotus/view'
#
#   module Articles
#     class Show
#       include Lotus::View
#     end
#   end
#
#   Articles::Show.layout # => nil
#
# @example Custom layout
#   require 'lotus/view'
#
#   class ArticlesLayout
#     include Lotus::Layout
#   end
#
#   module Articles
#     class Show
#       include Lotus::View
#       layout :articles
#     end
#   end
#
#   Articles::Show.layout # => :articles
#
# @example Global configuration
#   require 'lotus/view'
#
#   class ApplicationLayout
#     include Lotus::Layout
#   end
#
#   module Articles
#     class Show
#       include Lotus::View
#     end
#   end
#
#   Lotus::View.layout = :application
#   Articles::Show.layout # => nil
#
#   Lotus::View.load!
#   Articles::Show.layout # => :application
#
# @example Global configuration with custom layout
#   require 'lotus/view'
#
#   class ApplicationLayout
#     include Lotus::Layout
#   end
#
#   class ArticlesLayout
#     include Lotus::Layout
#   end
#
#   module Articles
#     class Show
#       include Lotus::View
#       layout :articles
#     end
#   end
#
#   Lotus::View.layout = :application
#   Articles::Show.layout # => :articles
#
#   Lotus::View.load!
#   Articles::Show.layout # => :articles
#
# @example Disable layout for the view
#   require 'lotus/view'
#
#   class ApplicationLayout
#     include Lotus::Layout
#   end
#
#   module Articles
#     class Show
#       include Lotus::View
#       layout false
#     end
#   end
#
#   Lotus::View.load!
#   Articles::Show.layout # => Lotus::View::Rendering::NullLayout
When a value is given, it specifies the layout.

When the global configuration is set (`Lotus::View.layout=`), after the
loading process, it will return that layout if not otherwise specified.
When a value is given it specifies the layout . When the global configuration is set ( ` Lotus :: View . layout = ` ) after the loading process it will return that layout if not otherwise specified .
def layout(value = nil)
        if value.nil?
          @_layout ||= Rendering::LayoutFinder.find(@layout || configuration.layout, configuration.namespace)
        elsif !value
          @layout = Lotus::View::Rendering::NullLayout
        else
          @layout = value
        end
      end
def layout ( value = nil ) if value . nil? @_layout ||= Rendering :: LayoutFinder . find ( @layout || configuration . layout , configuration . namespace ) elsif ! value @layout = Lotus :: View :: Rendering :: NullLayout else @layout = value end end
When a value is given, it specifies the layout.
When a value is given it specifies the layout .
the specified layout for this view, if set
the specified layout for this view if set
Symbol, nil
value
the layout name
the layout name
since
None
see
None
example
Default usage require 'lotus/view' module Articles class Show include Lotus::View end end Articles::Show.layout # => nil
Default usage require ' lotus / view ' module Articles class Show include Lotus :: View end end Articles :: Show . layout # = > nil
example
Custom layout require 'lotus/view' class ArticlesLayout include Lotus::Layout end module Articles class Show include Lotus::View layout :articles end end Articles::Show.layout # => :articles
Custom layout require ' lotus / view ' class ArticlesLayout include Lotus :: Layout end module Articles class Show include Lotus :: View layout : articles end end Articles :: Show . layout # = > : articles
example
Global configuration require 'lotus/view' class ApplicationLayout include Lotus::Layout end module Articles class Show include Lotus::View end end Lotus::View.layout = :application Articles::Show.layout # => nil Lotus::View.load. Articles::Show.layout # => :application
Global configuration require ' lotus / view ' class ApplicationLayout include Lotus :: Layout end module Articles class Show include Lotus :: View end end Lotus :: View . layout = : application Articles :: Show . layout # = > nil Lotus :: View . load . Articles :: Show . layout # = > : application
example
Global configuration with custom layout require 'lotus/view' class ApplicationLayout include Lotus::Layout end class ArticlesLayout include Lotus::Layout end module Articles class Show include Lotus::View layout :articles end end Lotus::View.layout = :application Articles::Show.layout # => :articles Lotus::View.load. Articles::Show.layout # => :articles
Global configuration with custom layout require ' lotus / view ' class ApplicationLayout include Lotus :: Layout end class ArticlesLayout include Lotus :: Layout end module Articles class Show include Lotus :: View layout : articles end end Lotus :: View . layout = : application Articles :: Show . layout # = > : articles Lotus :: View . load . Articles :: Show . layout # = > : articles
example
Disable layout for the view require 'lotus/view' class ApplicationLayout include Lotus::Layout end module Articles class Show include Lotus::View layout false end end Lotus::View.load. Articles::Show.layout # => Lotus::View::Rendering::NullLayout
Disable layout for the view require ' lotus / view ' class ApplicationLayout include Lotus :: Layout end module Articles class Show include Lotus :: View layout false end end Lotus :: View . load . Articles :: Show . layout # = > Lotus :: View :: Rendering :: NullLayout