Sha256: d68ef19b690e4d6ac68778ed079a498f09572ecf328a607ead5063b60aef96f1

Contents?: true

Size: 930 Bytes

Versions: 8

Compression:

Stored size: 930 Bytes

Contents

module Invoker
  module IPC
    module Message
      class ListResponse < Base
        include Serialization
        message_attributes :processes
        def initialize(options)
          self.processes = []
          process_array = options[:processes] || options['processes']
          process_array.each do |process_hash|
            processes << Process.new(process_hash)
          end
        end

        def self.from_workers(workers)
          process_array = []
          Invoker.config.processes.each do |process|
            worker_attrs = {
              :shell_command => process.cmd, :process_name => process.label,
              :dir => process.dir
            }
            if worker = workers[process.label]
              worker_attrs.update(pid: worker.pid)
            end
            process_array << worker_attrs
          end

          new(processes: process_array)
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
invoker-1.3.2 lib/invoker/ipc/message/list_response.rb
invoker-1.3.1 lib/invoker/ipc/message/list_response.rb
invoker-1.3.0 lib/invoker/ipc/message/list_response.rb
invoker-1.2.0 lib/invoker/ipc/message/list_response.rb
invoker-1.2.0.pre2 lib/invoker/ipc/message/list_response.rb
invoker-1.2.0.pre1 lib/invoker/ipc/message/list_response.rb
invoker-1.2.0.pre lib/invoker/ipc/message/list_response.rb
invoker-1.1.0 lib/invoker/ipc/message/list_response.rb