Class: React::Rails::HotLoader::Server
- Inherits:
-
Object
- Object
- React::Rails::HotLoader::Server
- Defined in:
- lib/hot_loader/server.rb
Instance Attribute Summary collapse
-
#change_set_class ⇒ Object
readonly
Returns the value of attribute change_set_class.
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
Instance Method Summary collapse
-
#initialize(host: "0.0.0.0", port:, change_set_class: React::Rails::HotLoader::AssetChangeSet) ⇒ Server
constructor
A new instance of Server.
-
#restart ⇒ Object
Restarts the server if it has stopped.
Constructor Details
#initialize(host: "0.0.0.0", port:, change_set_class: React::Rails::HotLoader::AssetChangeSet) ⇒ Server
Returns a new instance of Server.
9 10 11 12 13 14 |
# File 'lib/hot_loader/server.rb', line 9 def initialize(host: "0.0.0.0", port:, change_set_class: React::Rails::HotLoader::AssetChangeSet) @host = host @port = port @change_set_class = change_set_class @processed_msg = Hash.new end |
Instance Attribute Details
#change_set_class ⇒ Object (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 |
#host ⇒ Object (readonly)
Returns the value of attribute host.
7 8 9 |
# File 'lib/hot_loader/server.rb', line 7 def host @host end |
#port ⇒ Object (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
#restart ⇒ Object
Restarts the server if it has stopped
17 18 19 20 21 22 23 24 25 |
# File 'lib/hot_loader/server.rb', line 17 def restart start rescue StandardError => err if err. =~ /no acceptor/ React::Rails::HotLoader.log("WS server is already running (#{ws_url})") else React::Rails::HotLoader.error(err) end end |