Class: Spanx::Runner
- Inherits:
-
Object
- Object
- Spanx::Runner
- Defined in:
- lib/spanx/runner.rb
Instance Attribute Summary collapse
-
#actors ⇒ Object
Returns the value of attribute actors.
-
#config ⇒ Object
Returns the value of attribute config.
-
#queue ⇒ Object
Returns the value of attribute queue.
Instance Method Summary collapse
- #analyzer ⇒ Object
-
#collector ⇒ Object
actors.
-
#initialize(*args) ⇒ Runner
constructor
A new instance of Runner.
- #log_reader ⇒ Object
- #run ⇒ Object
-
#whitelist ⇒ Object
helpers.
- #writer ⇒ Object
Constructor Details
#initialize(*args) ⇒ Runner
Returns a new instance of Runner.
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/spanx/runner.rb', line 28 def initialize(*args) @config = args.last.is_a?(Hash) ? args.pop : {} @queue = Queue.new validate_args!(args) @actors = args.map { |actor| self.send(actor.to_sym) } Daemonize.daemonize if config[:daemonize] STDOUT.sync = true if config[:debug] end |
Instance Attribute Details
#actors ⇒ Object
Returns the value of attribute actors.
26 27 28 |
# File 'lib/spanx/runner.rb', line 26 def actors @actors end |
#config ⇒ Object
Returns the value of attribute config.
26 27 28 |
# File 'lib/spanx/runner.rb', line 26 def config @config end |
#queue ⇒ Object
Returns the value of attribute queue.
26 27 28 |
# File 'lib/spanx/runner.rb', line 26 def queue @queue end |
Instance Method Details
#analyzer ⇒ Object
58 59 60 |
# File 'lib/spanx/runner.rb', line 58 def analyzer @analyzer ||= Spanx::Actor::Analyzer.new(config) end |
#collector ⇒ Object
actors
46 47 48 |
# File 'lib/spanx/runner.rb', line 46 def collector @collector ||= Spanx::Actor::Collector.new(config, queue) end |
#log_reader ⇒ Object
50 51 52 |
# File 'lib/spanx/runner.rb', line 50 def log_reader @log_reader ||= Spanx::Actor::LogReader.new(config[:access_log], queue, config[:log_reader][:tail_interval], whitelist) end |
#run ⇒ Object
39 40 41 42 |
# File 'lib/spanx/runner.rb', line 39 def run threads = actors.map(&:run) threads.last.join end |