Class: Railsmith::Configuration
- Inherits:
-
Object
- Object
- Railsmith::Configuration
- Defined in:
- lib/railsmith/configuration.rb
Overview
Stores global settings used by gem components.
Instance Attribute Summary collapse
-
#async_enqueuer ⇒ Object
Returns the value of attribute async_enqueuer.
-
#async_job_class ⇒ Object
Returns the value of attribute async_job_class.
-
#cross_domain_allowlist ⇒ Object
Returns the value of attribute cross_domain_allowlist.
-
#custom_coercions ⇒ Object
readonly
Returns the hash of custom coercions (keyed by type Class or Symbol).
-
#fail_on_arch_violations ⇒ Object
Returns the value of attribute fail_on_arch_violations.
-
#instrumentation_enabled ⇒ Object
Returns the value of attribute instrumentation_enabled.
-
#on_cross_domain_violation ⇒ Object
Returns the value of attribute on_cross_domain_violation.
-
#pipeline_detect_merge_collisions ⇒ Object
Returns the value of attribute pipeline_detect_merge_collisions.
-
#strict_mode ⇒ Object
Returns the value of attribute strict_mode.
-
#warn_on_cross_domain_calls ⇒ Object
Returns the value of attribute warn_on_cross_domain_calls.
Instance Method Summary collapse
- #after_action(*actions, **options) ⇒ Object
- #around_action(*actions, **options) ⇒ Object
- #before_action(*actions, **options) ⇒ Object
- #default_async_job_class ⇒ Object
-
#global_hooks ⇒ Object
The live HookRegistry holding every globally declared hook.
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
-
#register_coercion(type, coercer) ⇒ Object
Register a custom type coercion used by the input DSL.
-
#reset_global_hooks! ⇒ Object
Clear every global hook.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
14 15 16 17 18 19 20 |
# File 'lib/railsmith/configuration.rb', line 14 def initialize set_default_flags set_default_hook_state set_default_async_config set_default_instrumentation end |
Instance Attribute Details
#async_enqueuer ⇒ Object
Returns the value of attribute async_enqueuer.
6 7 8 |
# File 'lib/railsmith/configuration.rb', line 6 def async_enqueuer @async_enqueuer end |
#async_job_class ⇒ Object
Returns the value of attribute async_job_class.
6 7 8 |
# File 'lib/railsmith/configuration.rb', line 6 def async_job_class @async_job_class end |
#cross_domain_allowlist ⇒ Object
Returns the value of attribute cross_domain_allowlist.
6 7 8 |
# File 'lib/railsmith/configuration.rb', line 6 def cross_domain_allowlist @cross_domain_allowlist end |
#custom_coercions ⇒ Object (readonly)
Returns the hash of custom coercions (keyed by type Class or Symbol).
41 42 43 |
# File 'lib/railsmith/configuration.rb', line 41 def custom_coercions @custom_coercions end |
#fail_on_arch_violations ⇒ Object
Returns the value of attribute fail_on_arch_violations.
6 7 8 |
# File 'lib/railsmith/configuration.rb', line 6 def fail_on_arch_violations @fail_on_arch_violations end |
#instrumentation_enabled ⇒ Object
Returns the value of attribute instrumentation_enabled.
6 7 8 |
# File 'lib/railsmith/configuration.rb', line 6 def instrumentation_enabled @instrumentation_enabled end |
#on_cross_domain_violation ⇒ Object
Returns the value of attribute on_cross_domain_violation.
6 7 8 |
# File 'lib/railsmith/configuration.rb', line 6 def on_cross_domain_violation @on_cross_domain_violation end |
#pipeline_detect_merge_collisions ⇒ Object
Returns the value of attribute pipeline_detect_merge_collisions.
6 7 8 |
# File 'lib/railsmith/configuration.rb', line 6 def pipeline_detect_merge_collisions @pipeline_detect_merge_collisions end |
#strict_mode ⇒ Object
Returns the value of attribute strict_mode.
6 7 8 |
# File 'lib/railsmith/configuration.rb', line 6 def strict_mode @strict_mode end |
#warn_on_cross_domain_calls ⇒ Object
Returns the value of attribute warn_on_cross_domain_calls.
6 7 8 |
# File 'lib/railsmith/configuration.rb', line 6 def warn_on_cross_domain_calls @warn_on_cross_domain_calls end |
Instance Method Details
#after_action(*actions, **options) ⇒ Object
77 78 79 |
# File 'lib/railsmith/configuration.rb', line 77 def after_action(*actions, **, &) add_global_hook(:after, actions, , &) end |
#around_action(*actions, **options) ⇒ Object
81 82 83 |
# File 'lib/railsmith/configuration.rb', line 81 def around_action(*actions, **, &) add_global_hook(:around, actions, , &) end |
#before_action(*actions, **options) ⇒ Object
73 74 75 |
# File 'lib/railsmith/configuration.rb', line 73 def before_action(*actions, **, &) add_global_hook(:before, actions, , &) end |
#default_async_job_class ⇒ Object
22 23 24 25 26 |
# File 'lib/railsmith/configuration.rb', line 22 def default_async_job_class return nil unless defined?(Railsmith::AsyncNestedWriteJob) Railsmith::AsyncNestedWriteJob end |
#global_hooks ⇒ Object
The live HookRegistry holding every globally declared hook. Tests can reset it via reset_global_hooks! between examples.
64 65 66 |
# File 'lib/railsmith/configuration.rb', line 64 def global_hooks @global_hooks ||= Railsmith::Hooks::HookRegistry.new end |
#register_coercion(type, coercer) ⇒ Object
36 37 38 |
# File 'lib/railsmith/configuration.rb', line 36 def register_coercion(type, coercer) @custom_coercions[type] = coercer end |
#reset_global_hooks! ⇒ Object
Clear every global hook. Primarily useful in test teardown.
69 70 71 |
# File 'lib/railsmith/configuration.rb', line 69 def reset_global_hooks! @global_hooks = nil end |