Sha256: fc9be5da3023f7c482d19ae35921ea99182a084394f7ca1f1dc9c1d5087d9ca0

Contents?: true

Size: 945 Bytes

Versions: 11

Compression:

Stored size: 945 Bytes

Contents

module Eye::Group::Data

  def status_data(opts = {})
    plist = @processes.map { |p| p.status_data(opts) }

    h = { name: name, type: :group, subtree: plist }

    h[:debug] = debug_data if opts[:debug]

    # show current chain
    if scheduled_call = @scheduled_call
      h[:current_command] = scheduled_call[:command]

      if (chain_commands = scheduler_commands_list) && chain_commands.present?
        h[:chain_commands] = chain_commands
      end

      if @chain_processes_current && @chain_processes_count
        h[:chain_progress] = [@chain_processes_current, @chain_processes_count]
      end
    end

    h
  end

  def status_data_short
    h = {}
    @processes.each do |p|
      state = p.state
      h[state] ||= 0
      h[state] += 1
    end
    { name: (@name == '__default__' ? 'default' : @name), type: :group, states: h }
  end

  def debug_data
    { queue: scheduler_commands_list, chain: chain_status }
  end

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
eye-0.10.1.pre lib/eye/group/data.rb
eye-0.10.0 lib/eye/group/data.rb
eye-0.10.0.alpha2 lib/eye/group/data.rb
eye-0.10.0.alpha lib/eye/group/data.rb
eye-0.9.4.nosigar lib/eye/group/data.rb
eye-0.9.4 lib/eye/group/data.rb
eye-0.9.3 lib/eye/group/data.rb
eye-0.9.2.nosigar lib/eye/group/data.rb
eye-0.9.2 lib/eye/group/data.rb
eye-0.9.1 lib/eye/group/data.rb
eye-0.9.pre lib/eye/group/data.rb