Sha256: 53a2f2b0fdeb34c468c499da3785740feafd7906b82986a6461b48b6eeed31ee

Contents?: true

Size: 1.33 KB

Versions: 29

Compression:

Stored size: 1.33 KB

Contents

# frozen_string_literal: true

require_relative 'selector_classes/common'
require_relative 'selector_classes/task'
require_relative 'selector_evaluator'

module Checkoff
  # Evaluates task selectors against a task
  class TaskSelectorEvaluator < SelectorEvaluator
    # @param task [Asana::Resources::Task]
    # @param tasks [Checkoff::Tasks]
    def initialize(task:,
                   tasks: Checkoff::Tasks.new)
      @item = task
      @tasks = tasks
      super()
    end

    private

    COMMON_FUNCTION_EVALUATORS = (Checkoff::SelectorClasses::Common.constants.map do |const|
      Checkoff::SelectorClasses::Common.const_get(const)
    end - [Checkoff::SelectorClasses::Common::FunctionEvaluator]).freeze

    TASK_FUNCTION_EVALUATORS = (Checkoff::SelectorClasses::Task.constants.map do |const|
      Checkoff::SelectorClasses::Task.const_get(const)
    end - [Checkoff::SelectorClasses::Task::FunctionEvaluator]).freeze

    FUNCTION_EVALUTORS = (COMMON_FUNCTION_EVALUATORS + TASK_FUNCTION_EVALUATORS).freeze

    # @return [Array<Class<TaskSelectorClasses::FunctionEvaluator>>]
    def function_evaluators
      FUNCTION_EVALUTORS
    end

    # @return [Hash]
    def initializer_kwargs
      { tasks: tasks }
    end

    # @return [Asana::Resources::Task]
    attr_reader :item
    # @return [Checkoff::Tasks]
    attr_reader :tasks
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
checkoff-0.97.0 lib/checkoff/internal/task_selector_evaluator.rb
checkoff-0.96.0 lib/checkoff/internal/task_selector_evaluator.rb
checkoff-0.95.0 lib/checkoff/internal/task_selector_evaluator.rb
checkoff-0.94.0 lib/checkoff/internal/task_selector_evaluator.rb
checkoff-0.93.0 lib/checkoff/internal/task_selector_evaluator.rb
checkoff-0.92.0 lib/checkoff/internal/task_selector_evaluator.rb
checkoff-0.91.0 lib/checkoff/internal/task_selector_evaluator.rb
checkoff-0.90.0 lib/checkoff/internal/task_selector_evaluator.rb
checkoff-0.89.0 lib/checkoff/internal/task_selector_evaluator.rb
checkoff-0.88.0 lib/checkoff/internal/task_selector_evaluator.rb
checkoff-0.87.0 lib/checkoff/internal/task_selector_evaluator.rb
checkoff-0.86.0 lib/checkoff/internal/task_selector_evaluator.rb
checkoff-0.85.0 lib/checkoff/internal/task_selector_evaluator.rb
checkoff-0.84.0 lib/checkoff/internal/task_selector_evaluator.rb
checkoff-0.83.0 lib/checkoff/internal/task_selector_evaluator.rb
checkoff-0.82.0 lib/checkoff/internal/task_selector_evaluator.rb
checkoff-0.69.0 lib/checkoff/internal/task_selector_evaluator.rb
checkoff-0.68.0 lib/checkoff/internal/task_selector_evaluator.rb
checkoff-0.67.1 lib/checkoff/internal/task_selector_evaluator.rb
checkoff-0.67.0 lib/checkoff/internal/task_selector_evaluator.rb