class RailsVite::DevServer
Attributes
config[R]
Configure dev server connection timeout (in seconds), default: 0.01 Webpacker.server.connect_timeout = 1 cattr_accessor(:connect_timeout) { 0.01 }
Public Class Methods
new(config)
click to toggle source
# File lib/rails_vite/dev_server.rb, line 9 def initialize(config) @config = config end
Public Instance Methods
host()
click to toggle source
# File lib/rails_vite/dev_server.rb, line 24 def host fetch(:host) end
host_with_port()
click to toggle source
# File lib/rails_vite/dev_server.rb, line 45 def host_with_port "#{host}:#{port}" end
https?()
click to toggle source
# File lib/rails_vite/dev_server.rb, line 32 def https? case fetch(:https) when true, 'true', Hash true else false end end
port()
click to toggle source
# File lib/rails_vite/dev_server.rb, line 28 def port fetch(:port) end
pretty?()
click to toggle source
# File lib/rails_vite/dev_server.rb, line 49 def pretty? fetch(:pretty) end
protocol()
click to toggle source
# File lib/rails_vite/dev_server.rb, line 41 def protocol https? ? 'https' : 'http' end
running?()
click to toggle source
# File lib/rails_vite/dev_server.rb, line 13 def running? if config.server.present? Socket.tcp(host, port, connect_timeout: connect_timeout).close true else false end rescue false end
Private Instance Methods
fetch(key)
click to toggle source
# File lib/rails_vite/dev_server.rb, line 54 def fetch(key) config.fetch(key) end