Module: LayoutOptions::InstanceMethods

Defined in:
lib/layout_options/layout_options.rb

Instance Method Summary collapse

Instance Method Details

#layout_options_selectorObject

:nodoc:



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/layout_options/layout_options.rb', line 62

def layout_options_selector # :nodoc:
  layout_options = LayoutOptions::Storage[controller_name] || {}
  layout_options = layout_options.clone unless layout_options.empty?
  no_layout = layout_options.delete(:none) || []
  no_layout = [no_layout] unless Array === no_layout
  action = action_name.to_sym

  layout_options.each do |key, values|
    values = [values] unless Array === values
    return key.to_s if values.include?(action)
  end

  no_layout.map! { |value| value.to_sym }
  return no_layout.include?(action) ? false : LayoutOptions.default_layout.to_s
end