Class: StimulusReflex::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/stimulus_reflex/configuration.rb

Constant Summary collapse

DEFAULT_LOGGING =
proc { "[#{session_id}] #{operation_counter.magenta} #{reflex_info.green} -> #{selector.cyan} via #{mode} Morph (#{operation.yellow})" }

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



29
30
31
32
33
34
35
36
37
38
39
# File 'lib/stimulus_reflex/configuration.rb', line 29

def initialize
  @on_failed_sanity_checks = :exit
  @on_missing_default_urls = :warn
  @parent_channel = "ApplicationCable::Channel"
  @logging = DEFAULT_LOGGING
  @logger = Rails.logger
  @middleware = ActionDispatch::MiddlewareStack.new
  @morph_operation = :morph
  @replace_operation = :inner_html
  @precompile_assets = true
end

Instance Attribute Details

#loggerObject

Returns the value of attribute logger.



17
18
19
# File 'lib/stimulus_reflex/configuration.rb', line 17

def logger
  @logger
end

#loggingObject

Returns the value of attribute logging.



17
18
19
# File 'lib/stimulus_reflex/configuration.rb', line 17

def logging
  @logging
end

#middlewareObject

Returns the value of attribute middleware.



17
18
19
# File 'lib/stimulus_reflex/configuration.rb', line 17

def middleware
  @middleware
end

#morph_operationObject

Returns the value of attribute morph_operation.



17
18
19
# File 'lib/stimulus_reflex/configuration.rb', line 17

def morph_operation
  @morph_operation
end

#on_failed_sanity_checksObject

Returns the value of attribute on_failed_sanity_checks.



17
18
19
# File 'lib/stimulus_reflex/configuration.rb', line 17

def on_failed_sanity_checks
  @on_failed_sanity_checks
end

#on_missing_default_urlsObject

Returns the value of attribute on_missing_default_urls.



17
18
19
# File 'lib/stimulus_reflex/configuration.rb', line 17

def on_missing_default_urls
  @on_missing_default_urls
end

#parent_channelObject

Returns the value of attribute parent_channel.



17
18
19
# File 'lib/stimulus_reflex/configuration.rb', line 17

def parent_channel
  @parent_channel
end

#precompile_assetsObject

Returns the value of attribute precompile_assets.



17
18
19
# File 'lib/stimulus_reflex/configuration.rb', line 17

def precompile_assets
  @precompile_assets
end

#replace_operationObject

Returns the value of attribute replace_operation.



17
18
19
# File 'lib/stimulus_reflex/configuration.rb', line 17

def replace_operation
  @replace_operation
end

Instance Method Details

#on_new_version_availableObject



21
22
23
# File 'lib/stimulus_reflex/configuration.rb', line 21

def on_new_version_available
  warn "NOTICE: The `config.on_new_version_available` option has been removed from the StimulusReflex initializer. You can safely remove this option from your initializer."
end

#on_new_version_available=(_) ⇒ Object



25
26
27
# File 'lib/stimulus_reflex/configuration.rb', line 25

def on_new_version_available=(_)
  warn "NOTICE: The `config.on_new_version_available` option has been removed from the StimulusReflex initializer. You can safely remove this option from your initializer."
end