class RailsAjax::Configuration
Class used to configure and store the configuration of RailsAjax
Public Class Methods
new()
click to toggle source
Constructor
# File lib/rails-ajax/configuration.rb, line 23 def initialize # Set default values here @enabled = true @main_container = 'body' @flash_containers = {} @debug_alerts = false end
Public Instance Methods
debug_alerts(switch)
click to toggle source
Do we activate debugging alerts ?
- Parameters
-
switch (Boolean): Do we activate debugging alerts ?
# File lib/rails-ajax/configuration.rb, line 65 def debug_alerts(switch) @debug_alerts = switch end
debug_alerts?()
click to toggle source
Debug alerts ?
- Return
-
Boolean: Do we switch on debug alerts?
# File lib/rails-ajax/configuration.rb, line 18 def debug_alerts? return @debug_alerts end
enable(switch)
click to toggle source
enabled?()
click to toggle source
flash_containers(selectors_map = nil)
click to toggle source
Define the flash containers (add them to already present ones) if provided, and return them
- Parameters
-
selectors_map (map<Symbol,String>): The map of selectors, per flash message type (:alert, :noticeā¦)
- Return
-
map<Symbol,String>: The map of selectors [optional = nil]
# File lib/rails-ajax/configuration.rb, line 56 def flash_containers(selectors_map = nil) @flash_containers.merge!(selectors_map) if (selectors_map != nil) return @flash_containers end
main_container(selector = nil)
click to toggle source
Define the main container if provided, and return it
- Parameters
-
selector (String): Selector used to identify the container [optional = nil]
- Return
-
String: The CSS selector of the main container
# File lib/rails-ajax/configuration.rb, line 45 def main_container(selector = nil) @main_container = selector if (selector != nil) return @main_container end