Sha256: 2e2bde13c3ace6598d84c06466a441f7d8469f151cada52a71e939310209c62d

Contents?: true

Size: 616 Bytes

Versions: 5

Compression:

Stored size: 616 Bytes

Contents

# frozen_string_literal: true

module Attr
  module Gather
    module Workflow
      # @api private
      class Task
        attr_accessor :depends_on, :name

        def initialize(name:, depends_on: [])
          @name = name
          @depends_on = depends_on
        end

        def depends_on?(other_task)
          depends_on.include?(other_task.name)
        end

        def fullfilled_given_remaining_tasks?(task_list)
          task_list.none? { |list_task| depends_on?(list_task) }
        end

        def as_json
          { name: name, depends_on: depends_on }
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
attr-gather-1.1.3 lib/attr/gather/workflow/task.rb
attr-gather-1.1.2 lib/attr/gather/workflow/task.rb
attr-gather-1.1.1 lib/attr/gather/workflow/task.rb
attr-gather-1.1.0 lib/attr/gather/workflow/task.rb
attr-gather-1.0.0 lib/attr/gather/workflow/task.rb