Class: Latte::Server
Constant Summary collapse
- CHECK_ALIVE_INTERVAL =
5
Instance Method Summary collapse
- #listen_on(*addresses) ⇒ Object
- #run ⇒ Object
- #running_server?(address) ⇒ Boolean
- #server_exists_for?(address) ⇒ Boolean
- #server_for(address) ⇒ Object
Instance Method Details
#listen_on(*addresses) ⇒ Object
13 14 15 16 |
# File 'lib/latte/server.rb', line 13 def listen_on *addresses return if addresses.empty? self.addresses = addresses end |
#run ⇒ Object
18 19 20 21 |
# File 'lib/latte/server.rb', line 18 def run logger.debug "I will listen on #{addresses.map(&:to_s).join(',')}" listen end |
#running_server?(address) ⇒ Boolean
34 35 36 37 38 |
# File 'lib/latte/server.rb', line 34 def running_server? address return false unless server_exists_for? address server = server_for address server.alive? end |
#server_exists_for?(address) ⇒ Boolean
44 45 46 |
# File 'lib/latte/server.rb', line 44 def server_exists_for? address !server_for(address).nil? end |
#server_for(address) ⇒ Object
40 41 42 |
# File 'lib/latte/server.rb', line 40 def server_for address children[address] end |