Class: CableReady::Config
- Inherits:
-
Object
- Object
- CableReady::Config
- Includes:
- MonitorMixin, Observable, Singleton
- Defined in:
- lib/cable_ready/config.rb
Overview
This class is a process level singleton shared by all threads: CableReady::Config.instance
Instance Attribute Summary collapse
-
#broadcast_job_queue ⇒ Object
Returns the value of attribute broadcast_job_queue.
-
#on_failed_sanity_checks ⇒ Object
Returns the value of attribute on_failed_sanity_checks.
-
#precompile_assets ⇒ Object
Returns the value of attribute precompile_assets.
-
#updatable_debounce_adapter ⇒ Object
Returns the value of attribute updatable_debounce_adapter.
-
#updatable_debounce_time ⇒ Object
Returns the value of attribute updatable_debounce_time.
- #verifier_key ⇒ Object
Instance Method Summary collapse
- #add_operation_name(name) ⇒ Object
- #default_operation_names ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #observers ⇒ Object
- #on_new_version_available ⇒ Object
- #on_new_version_available=(_) ⇒ Object
- #operation_names ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
25 26 27 28 29 30 31 32 |
# File 'lib/cable_ready/config.rb', line 25 def initialize super @operation_names = Set.new(default_operation_names) @on_failed_sanity_checks = :exit @broadcast_job_queue = :default @precompile_assets = true @updatable_debounce_time = 0.1.seconds end |
Instance Attribute Details
#broadcast_job_queue ⇒ Object
Returns the value of attribute broadcast_job_queue.
14 15 16 |
# File 'lib/cable_ready/config.rb', line 14 def broadcast_job_queue @broadcast_job_queue end |
#on_failed_sanity_checks ⇒ Object
Returns the value of attribute on_failed_sanity_checks.
14 15 16 |
# File 'lib/cable_ready/config.rb', line 14 def on_failed_sanity_checks @on_failed_sanity_checks end |
#precompile_assets ⇒ Object
Returns the value of attribute precompile_assets.
14 15 16 |
# File 'lib/cable_ready/config.rb', line 14 def precompile_assets @precompile_assets end |
#updatable_debounce_adapter ⇒ Object
Returns the value of attribute updatable_debounce_adapter.
14 15 16 |
# File 'lib/cable_ready/config.rb', line 14 def updatable_debounce_adapter @updatable_debounce_adapter end |
#updatable_debounce_time ⇒ Object
Returns the value of attribute updatable_debounce_time.
14 15 16 |
# File 'lib/cable_ready/config.rb', line 14 def updatable_debounce_time @updatable_debounce_time end |
#verifier_key ⇒ Object
38 39 40 |
# File 'lib/cable_ready/config.rb', line 38 def verifier_key @verifier_key || Rails.application.key_generator.generate_key("cable_ready/verifier_key") end |
Instance Method Details
#add_operation_name(name) ⇒ Object
46 47 48 49 50 51 |
# File 'lib/cable_ready/config.rb', line 46 def add_operation_name(name) synchronize do @operation_names << name.to_sym notify_observers name.to_sym end end |
#default_operation_names ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/cable_ready/config.rb', line 53 def default_operation_names Set.new(i[ add_css_class append clear_storage console_log console_table dispatch_event go graft inner_html insert_adjacent_html insert_adjacent_text morph notification outer_html prepend push_state redirect_to reload remove remove_attribute remove_css_class remove_storage_item replace replace_state scroll_into_view set_attribute set_dataset_property set_focus set_property set_storage_item set_style set_styles set_title set_value text_content ]).freeze end |
#observers ⇒ Object
34 35 36 |
# File 'lib/cable_ready/config.rb', line 34 def observers @observer_peers&.keys || [] end |
#on_new_version_available ⇒ Object
17 18 19 |
# File 'lib/cable_ready/config.rb', line 17 def on_new_version_available warn "NOTICE: The `config.on_new_version_available` option has been removed from the CableReady initializer. You can safely remove this option from your initializer." end |
#on_new_version_available=(_) ⇒ Object
21 22 23 |
# File 'lib/cable_ready/config.rb', line 21 def on_new_version_available=(_) warn "NOTICE: The `config.on_new_version_available` option has been removed from the CableReady initializer. You can safely remove this option from your initializer." end |
#operation_names ⇒ Object
42 43 44 |
# File 'lib/cable_ready/config.rb', line 42 def operation_names @operation_names.to_a end |