Class: Lookbook::Engine

Inherits:
Rails::Engine
  • Object
show all
Defined in:
lib/lookbook/engine.rb

Class Method Summary collapse

Class Method Details

.mounted_pathObject



135
136
137
# File 'lib/lookbook/engine.rb', line 135

def mounted_path
  Lookbook::Engine.routes.find_script_name({})
end

.parserObject



139
140
141
# File 'lib/lookbook/engine.rb', line 139

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

.websocketObject



119
120
121
122
123
124
125
126
127
128
129
# File 'lib/lookbook/engine.rb', line 119

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

.websocket_mount_pathObject



131
132
133
# File 'lib/lookbook/engine.rb', line 131

def websocket_mount_path
  "#{mounted_path}#{config.lookbook.cable.mount_path}" if websocket
end