Class: React::Rails::HotLoader::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/hot_loader/server.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(host: "0.0.0.0", port: 8082, change_set_class: React::Rails::HotLoader::AssetChangeSet) ⇒ Server

Returns a new instance of Server.



9
10
11
12
13
# File 'lib/hot_loader/server.rb', line 9

def initialize(host:  "0.0.0.0", port: 8082, change_set_class: React::Rails::HotLoader::AssetChangeSet)
  @host = host
  @port = port
  @change_set_class = change_set_class
end

Instance Attribute Details

#change_set_classObject (readonly)

Returns the value of attribute change_set_class.



7
8
9
# File 'lib/hot_loader/server.rb', line 7

def change_set_class
  @change_set_class
end

#hostObject (readonly)

Returns the value of attribute host.



7
8
9
# File 'lib/hot_loader/server.rb', line 7

def host
  @host
end

#portObject (readonly)

Returns the value of attribute port.



7
8
9
# File 'lib/hot_loader/server.rb', line 7

def port
  @port
end

Instance Method Details

#restartObject

Restarts the server if it has stopped



16
17
18
19
20
21
# File 'lib/hot_loader/server.rb', line 16

def restart
  return if running?
  start
rescue StandardError => err
  React::Rails::HotLoader.error(err)
end