Module: GreenHat::Web

Defined in:
lib/greenhat/web.rb

Overview

Web Helper

Defined Under Namespace

Classes: MyApp

Class Method Summary collapse

Class Method Details

.startObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/greenhat/web.rb', line 19

def self.start
  @thread = Thread.new do
    # original_stderr = $stderr.clone
    # original_stdout = $stdout.clone
    # $stderr.reopen(File.new('/dev/null', 'w'))
    # $stdout.reopen(File.new('/dev/null', 'w'))

    app = MyApp.run!
    # $stdout.reopen(original_stdout)
    # $stderr.reopen(original_stderr)

    # $stdout.reopen($STDOUT_CLONE)

    app
  end

  sleep 0.2
end

.stopObject



42
43
44
# File 'lib/greenhat/web.rb', line 42

def self.stop
  thread.kill if thread.alive?
end

.threadObject



38
39
40
# File 'lib/greenhat/web.rb', line 38

def self.thread
  @thread
end