Class: Lookbook::Engine
- Inherits:
-
Rails::Engine
- Object
- Rails::Engine
- Lookbook::Engine
- Defined in:
- lib/lookbook/engine.rb
Class Method Summary collapse
Class Method Details
.mounted_path ⇒ Object
131 132 133 |
# File 'lib/lookbook/engine.rb', line 131 def mounted_path Lookbook::Engine.routes.find_script_name({}) end |
.parser ⇒ Object
135 136 137 |
# File 'lib/lookbook/engine.rb', line 135 def parser @parser ||= Lookbook::Parser.new(config.lookbook.preview_paths) end |
.websocket ⇒ Object
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/lookbook/engine.rb', line 109 def websocket if config.lookbook.auto_refresh cable = ActionCable::Server::Configuration.new cable.cable = {adapter: "async"}.with_indifferent_access cable.mount_path = config.lookbook.cable_mount_path cable.connection_class = -> { Lookbook::Connection } cable.logger = config.lookbook.cable_logger @websocket ||= if Rails.version.to_f >= 6.0 ActionCable::Server::Base.new(config: cable) else websocket ||= ActionCable::Server::Base.new websocket.config = cable websocket end end end |
.websocket_mount_path ⇒ Object
127 128 129 |
# File 'lib/lookbook/engine.rb', line 127 def websocket_mount_path "#{mounted_path}#{config.lookbook.cable_mount_path}" if websocket end |