Sha256: 9831b2cc351d6c50f5f4d56f14484140ad4e622a2cfa1aa295da6185076b890b

Contents?: true

Size: 1.65 KB

Versions: 50

Compression:

Stored size: 1.65 KB

Contents

# frozen_string_literal: true

require_relative 'selector_classes/common'
require_relative 'selector_classes/project'
require_relative 'selector_evaluator'

module Checkoff
  # Evaluates project selectors against a project
  class ProjectSelectorEvaluator < SelectorEvaluator
    # @param project [Asana::Resources::Project]
    # @param projects [Checkoff::Projects]
    # @param custom_fields [Checkoff::CustomFields]
    def initialize(project:,
                   projects: Checkoff::Projects.new,
                   custom_fields: Checkoff::CustomFields.new)
      @item = project
      @projects = projects
      @custom_fields = custom_fields
      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

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

    FUNCTION_EVALUTORS = (COMMON_FUNCTION_EVALUATORS + PROJECT_FUNCTION_EVALUATORS).freeze

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

    # @return [Hash]
    def initializer_kwargs
      { projects: projects, custom_fields: custom_fields }
    end

    # @return [Asana::Resources::Project]
    attr_reader :item
    # @return [Checkoff::Projects]
    attr_reader :projects
    # @return [Checkoff::CustomFields]
    attr_reader :custom_fields
  end
end

Version data entries

50 entries across 50 versions & 1 rubygems

Version Path
checkoff-0.165.0 lib/checkoff/internal/project_selector_evaluator.rb
checkoff-0.164.0 lib/checkoff/internal/project_selector_evaluator.rb
checkoff-0.163.0 lib/checkoff/internal/project_selector_evaluator.rb
checkoff-0.162.0 lib/checkoff/internal/project_selector_evaluator.rb
checkoff-0.161.0 lib/checkoff/internal/project_selector_evaluator.rb
checkoff-0.160.0 lib/checkoff/internal/project_selector_evaluator.rb
checkoff-0.159.0 lib/checkoff/internal/project_selector_evaluator.rb
checkoff-0.158.0 lib/checkoff/internal/project_selector_evaluator.rb
checkoff-0.157.0 lib/checkoff/internal/project_selector_evaluator.rb
checkoff-0.156.0 lib/checkoff/internal/project_selector_evaluator.rb
checkoff-0.155.0 lib/checkoff/internal/project_selector_evaluator.rb
checkoff-0.154.0 lib/checkoff/internal/project_selector_evaluator.rb
checkoff-0.153.0 lib/checkoff/internal/project_selector_evaluator.rb
checkoff-0.152.0 lib/checkoff/internal/project_selector_evaluator.rb
checkoff-0.151.0 lib/checkoff/internal/project_selector_evaluator.rb
checkoff-0.150.0 lib/checkoff/internal/project_selector_evaluator.rb
checkoff-0.149.0 lib/checkoff/internal/project_selector_evaluator.rb
checkoff-0.148.0 lib/checkoff/internal/project_selector_evaluator.rb
checkoff-0.147.0 lib/checkoff/internal/project_selector_evaluator.rb
checkoff-0.145.0 lib/checkoff/internal/project_selector_evaluator.rb