module AbstractController::Layouts

def _default_layout(require_layout = false)

* template - The template object for the default layout (or nil)
==== Returns

an ArgumentError exception is raised (defaults to false)
* require_layout - If set to true and layout is not found,
==== Parameters

Optionally raises an exception if the layout could not be found.
Returns the default layout for this controller.
def _default_layout(require_layout = false)
  begin
    value = _layout if action_has_layout?
  rescue NameError => e
    raise e, "Could not render layout: #{e.message}"
  end
  if require_layout && action_has_layout? && !value
    raise ArgumentError,
      "There was no default layout for #{self.class} in #{view_paths.inspect}"
  end
  _normalize_layout(value)
end

def _include_layout?(options)

def _include_layout?(options)
  (options.keys & [:text, :inline, :partial]).empty? || options.key?(:layout)
end

def _layout; end

This will be overwritten by _write_layout_method
def _layout; end

def _layout_for_option(name)

* name - The name of the template
==== Parameters

Determine the layout for a given name, taking into account the name type.
def _layout_for_option(name)
  case name
  when String     then _normalize_layout(name)
  when Proc       then name
  when true       then Proc.new { _default_layout(true)  }
  when :default   then Proc.new { _default_layout(false) }
  when false, nil then nil
  else
    raise ArgumentError,
      "String, true, or false, expected for `layout'; you passed #{name.inspect}"
  end
end

def _normalize_layout(value)

def _normalize_layout(value)
  value.is_a?(String) && value !~ /\blayouts/ ? "layouts/#{value}" : value
end

def _normalize_options(options)

def _normalize_options(options)
  super
  if _include_layout?(options)
    layout = options.key?(:layout) ? options.delete(:layout) : :default
    options[:layout] = _layout_for_option(layout)
  end
end

def action_has_layout?

def action_has_layout?
  @_action_has_layout
end

def conditional_layout?

def conditional_layout?
  true
end

def initialize(*)

def initialize(*)
  @_action_has_layout = true
  super
end