Sha256: 93b0c07f4c64d392fc06bd17e99ef46ede3fa9817a8861ab84600a3c973508ad

Contents?: true

Size: 612 Bytes

Versions: 3

Compression:

Stored size: 612 Bytes

Contents

# frozen_string_literal: true

require_relative "process_set"

module Eye::Patch

  class GroupSet < Hash

    def initialize(application, processes)
      @application = application

      Array(processes).group_by { |item| item[:group] }.each do |group_name, items|
        name = group_name || "__default__"
        parse_group(name, items)
      end
    end

    private

    def parse_group(name, processes)
      self[name] = @application.merge(
        name: name,
        application: @application[:name],
      )

      self[name][:processes] = ProcessSet.new(self[name], processes)
    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
eye-patch-1.1.0 lib/eye/patch/group_set.rb
eye-patch-1.0.1 lib/eye/patch/group_set.rb
eye-patch-1.0.0 lib/eye/patch/group_set.rb