Class: SSLGate::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/ssl_gate/runner.rb

Overview

CLI runner.

Class Method Summary collapse

Class Method Details

.startObject



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/ssl_gate/runner.rb', line 16

def self.start
  config = symbolize_keys YAML.load_file('SSLGate')

  EventMachine.run do
    Signal.trap('INT')  { EM.stop if EM.reactor_running? }
    Signal.trap('TERM') { EM.stop if EM.reactor_running? }

    SSLGate.factory config
  end
rescue => e
  STDERR.puts e.message
end

.symbolize_keys(hash) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/ssl_gate/runner.rb', line 7

def self.symbolize_keys(hash)
  hash.each_with_object({}) do |(key, value), result|
    new_key = key.is_a?(String) ? key.to_sym : key
    new_value = value.is_a?(Hash) ? symbolize_keys(value) : value
    result[new_key] = new_value
    result
  end
end