Sha256: 307a3ca4faf7e3e25f98bca2da62ca89cde01f18d0c1f9d6846c5f8d324a5dd6

Contents?: true

Size: 1.77 KB

Versions: 32

Compression:

Stored size: 1.77 KB

Contents

# frozen_string_literal: true

require_relative 'selector_classes/common'
require_relative 'selector_classes/section'
require_relative 'selector_evaluator'

module Checkoff
  # Evaluates section selectors against a section
  class SectionSelectorEvaluator < SelectorEvaluator
    # @param section [Asana::Resources::Project]
    # @param client [Asana::Client]
    # @param projects [Checkoff::Projects]
    # @param sections [Checkoff::Sections]
    def initialize(section:,
                   client:,
                   projects: Checkoff::Projects.new(client: client),
                   sections: Checkoff::Sections.new)
      @item = section
      @client = client
      @projects = projects
      @sections = sections
      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

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

    FUNCTION_EVALUTORS = (COMMON_FUNCTION_EVALUATORS + SECTION_FUNCTION_EVALUATORS).freeze

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

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

    # @return [Asana::Resources::Project]
    attr_reader :item
    # @return [Checkoff::Sections]
    attr_reader :sections
    # @return [Checkoff::Projects]
    attr_reader :projects
    # @return [Asana::Client]
    attr_reader :client
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
checkoff-0.109.0 lib/checkoff/internal/section_selector_evaluator.rb
checkoff-0.108.0 lib/checkoff/internal/section_selector_evaluator.rb
checkoff-0.107.0 lib/checkoff/internal/section_selector_evaluator.rb
checkoff-0.106.0 lib/checkoff/internal/section_selector_evaluator.rb
checkoff-0.105.0 lib/checkoff/internal/section_selector_evaluator.rb
checkoff-0.104.0 lib/checkoff/internal/section_selector_evaluator.rb
checkoff-0.103.0 lib/checkoff/internal/section_selector_evaluator.rb
checkoff-0.102.0 lib/checkoff/internal/section_selector_evaluator.rb
checkoff-0.101.0 lib/checkoff/internal/section_selector_evaluator.rb
checkoff-0.100.0 lib/checkoff/internal/section_selector_evaluator.rb
checkoff-0.99.0 lib/checkoff/internal/section_selector_evaluator.rb
checkoff-0.98.0 lib/checkoff/internal/section_selector_evaluator.rb
checkoff-0.97.0 lib/checkoff/internal/section_selector_evaluator.rb
checkoff-0.96.0 lib/checkoff/internal/section_selector_evaluator.rb
checkoff-0.95.0 lib/checkoff/internal/section_selector_evaluator.rb
checkoff-0.94.0 lib/checkoff/internal/section_selector_evaluator.rb
checkoff-0.93.0 lib/checkoff/internal/section_selector_evaluator.rb
checkoff-0.92.0 lib/checkoff/internal/section_selector_evaluator.rb
checkoff-0.91.0 lib/checkoff/internal/section_selector_evaluator.rb
checkoff-0.90.0 lib/checkoff/internal/section_selector_evaluator.rb