Class: BuildStatusServer::Server

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Server

Returns a new instance of Server.



5
6
7
8
# File 'lib/build_status_server/server.rb', line 5

def initialize(options = {})
  @config = Config.new
  config.load(options)
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



3
4
5
# File 'lib/build_status_server/server.rb', line 3

def config
  @config
end

#storeObject (readonly)

Returns the value of attribute store.



3
4
5
# File 'lib/build_status_server/server.rb', line 3

def store
  @store
end

#udp_serverObject (readonly)

Returns the value of attribute udp_server.



3
4
5
# File 'lib/build_status_server/server.rb', line 3

def udp_server
  @udp_server
end

Instance Method Details

#listen(run_forever = true) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/build_status_server/server.rb', line 10

def listen(run_forever = true)
  setup_udp_server

  begin
    while run_forever
      process_loop
    end
  rescue Interrupt
    STDOUT.puts "Good bye."
    udp_server.close
    exit
  end
end