Class: Miron::Handler::Puma::Proxy

Inherits:
Object
  • Object
show all
Defined in:
lib/miron/handlers/puma.rb

Instance Method Summary collapse

Constructor Details

#initialize(mironfile, options) ⇒ Proxy

Returns a new instance of Proxy


29
30
31
32
33
34
# File 'lib/miron/handlers/puma.rb', line 29

def initialize(mironfile, options)
  @mironfile = mironfile
  @options = options
  @serv = ::Puma::Server.new(Puma.new(@mironfile))
  listen(@options['host'], @options['port'].to_i)
end

Instance Method Details

#listen(address, port) ⇒ Object


40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/miron/handlers/puma.rb', line 40

def listen(address, port)
  @serv.add_tcp_listener(address, port)
  @serv.run
  puts "Puma #{::Puma::Const::PUMA_VERSION} starting..."
  puts "* Environment: #{@options['environment']}"
  puts "* Listening on #{@options['host']}:#{@options['port']}"
  begin
    sleep
  rescue Interrupt
    puts '* Shutting down...'
  end
end

#stopObject


36
37
38
# File 'lib/miron/handlers/puma.rb', line 36

def stop
  @serv.stop
end