Class: WSOC::Runner

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRunner

Creates a new runner.

Since:

  • 0.1.0



40
41
42
43
44
# File 'lib/wsoc/runner.rb', line 40

def initialize
  @host = Config::DEFAULT_HOST
  @port = Config::DEFAULT_PORT
  @handler = nil
end

Instance Attribute Details

#hostObject (readonly)

Host to run the WSOC server on



30
31
32
# File 'lib/wsoc/runner.rb', line 30

def host
  @host
end

#portObject (readonly)

Port to run the WSOC server on



33
34
35
# File 'lib/wsoc/runner.rb', line 33

def port
  @port
end

Class Method Details

.start(args = ARGV) ⇒ Object

Starts the runner.

Parameters:

  • argvs (Array<String>)

    (ARGV) The arguments to run the runner with.

Since:

  • 0.1.0



54
55
56
57
# File 'lib/wsoc/runner.rb', line 54

def Runner.start(args=ARGV)
  runner = self.new()
  runner.run(*args)
end

Instance Method Details

#run(*args) ⇒ Object

Runs the runner.

Parameters:

  • args (Array<String>)

    The arguments to run the runner with.

Since:

  • 0.1.0



67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/wsoc/runner.rb', line 67

def run(*args)
  optparse(*args)

  options = {
    :env => :production,
    :host => @host,
    :port => @port
  }

  options.merge!(:server => @handler) if @handler

  App.run!(options)
end