Class: HK::Server

Inherits:
Rack::Server
  • Object
show all
Defined in:
lib/hotchkiss/server.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Server

Returns a new instance of Server.



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

def initialize(options)
  @options = options
end

Class Method Details

.start!(options) ⇒ Object



9
10
11
# File 'lib/hotchkiss/server.rb', line 9

def self.start!(options)
  new(options).start
end

Instance Method Details

#optionsObject



13
14
15
# File 'lib/hotchkiss/server.rb', line 13

def options
  @options
end

#startObject



17
18
19
20
21
22
23
# File 'lib/hotchkiss/server.rb', line 17

def start
  time = Time.now.strftime("%Y-%m-%d %H:%M:%S")
  puts "[#{time}] => Hotchkiss - #{HK::VERSION} version"
  puts "[#{time}] => It rolls on http://#{options[:Host]}:#{options[:Port]}"
  [:INT, :TERM].each { |sig| trap(sig) { exit } }
  super
end