lib/lotus/view/dsl.rb
def root(value = nil)
        if value.nil?
          configuration.root
        else
          configuration.root(value)
        end
      end
# When a value is given, specify a templates root path for the view.
# Otherwise, it returns templates root path.
#
# When not initialized, it will return the global value from `Lotus::View.root`.
#
# @param value [String] the templates root for this view
#
# @return [Pathname] the specified root for this view or the global value
#
# @since 0.1.0
#
# @example Default usage
#   require 'lotus/view'
#
#   module Articles
#     class Show
#       include Lotus::View
#     end
#   end
#
#   Lotus::View.configuration.root # => 'app/templates'
#   Articles::Show.root            # => 'app/templates'
#
# @example Custom root
#   require 'lotus/view'
#
#   module Articles
#     class Show
#       include Lotus::View
#       root 'path/to/articles/templates'
#     end
#   end
#
#   Lotus::View.configuration.root # => 'app/templates'
#   Articles::Show.root            # => 'path/to/articles/templates'
When a value is given, specify a templates root path for the view.
Otherwise, it returns templates root path.

When not initialized, it will return the global value from `Lotus::View.root`.
When a value is given specify a templates root path for the view . Otherwise it returns templates root path . When not initialized it will return the global value from ` Lotus :: View . root ` .
def root(value = nil)
        if value.nil?
          configuration.root
        else
          configuration.root(value)
        end
      end
def root ( value = nil ) if value . nil? configuration . root else configuration . root ( value ) end end
When a value is given, specify a templates root path for the view.
When a value is given specify a templates root path for the view .
the specified root for this view or the global value
the specified root for this view or the global value
Pathname
value
the templates root for this view
the templates root for this view
since
None
example
Default usage require 'lotus/view' module Articles class Show include Lotus::View end end Lotus::View.configuration.root # => 'app/templates' Articles::Show.root # => 'app/templates'
Default usage require ' lotus / view ' module Articles class Show include Lotus :: View end end Lotus :: View . configuration . root # = > ' app / templates ' Articles :: Show . root # = > ' app / templates '
example
Custom root require 'lotus/view' module Articles class Show include Lotus::View root 'path/to/articles/templates' end end Lotus::View.configuration.root # => 'app/templates' Articles::Show.root # => 'path/to/articles/templates'
Custom root require ' lotus / view ' module Articles class Show include Lotus :: View root ' path / to / articles / templates ' end end Lotus :: View . configuration . root # = > ' app / templates ' Articles :: Show . root # = > ' path / to / articles / templates '