class Lookbook::Engine

def cable

def cable
  @cable ||= ActionCable::Server::Configuration.new
end

def parser

def parser
  @parser ||= Lookbook::Parser.new(config.lookbook.preview_paths)
end

def websocket

def websocket
  if Rails.version.to_f >= 6.0
    @websocket ||= ActionCable::Server::Base.new(config: Lookbook::Engine.cable)
  else
    @websocket = ActionCable::Server::Base.new
    @websocket.config = Lookbook::Engine.cable
    @websocket
  end
end

def websocket_mount_path

def websocket_mount_path
  "#{Lookbook::Engine.routes.find_script_name({})}#{cable.mount_path}"
end