Class: Thor::AppWorker

Inherits:
Application show all
Defined in:
lib/ThorWorker.rb

Instance Attribute Summary collapse

Attributes inherited from Application

#request_exit

Instance Method Summary collapse

Methods inherited from Application

#amqp_handle_failure, #amqp_loop, #amqp_start, #amqp_stop, #run

Constructor Details

#initialize(opts = {}) ⇒ AppWorker

Returns a new instance of AppWorker.



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/ThorWorker.rb', line 26

def initialize(opts = {})
  super(opts)

  # Event Machine options
  options[:em_port] = 8467 # Thor on cell-phone keyboard
  options[:em_auth_token] = ""

  initialize_optparser { |opts|
    ############################
    # EventMachine Section
    ############################
    # EM Port
    opts.on( '-ep', '--em-port NUM', "EventMachine port") do |port|
      options[:em_port] = port
    end

    # EM Authentication token
    opts.on( '-eat', '--em-auth-token STRING', "Authentication token used for communication with EM") do |token|
      options[:em_auth_token] = token
    end
  }
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



24
25
26
# File 'lib/ThorWorker.rb', line 24

def options
  @options
end

#optparsObject

Returns the value of attribute optpars.



24
25
26
# File 'lib/ThorWorker.rb', line 24

def optpars
  @optpars
end

Instance Method Details

#mainObject

Main entry-point



50
51
52
# File 'lib/ThorWorker.rb', line 50

def main
  super()
end