Sha256: e6cc5f72958eb7d4f2c58af44c14307851d4b5ec3aaef89571954670512e2c93

Contents?: true

Size: 855 Bytes

Versions: 8

Compression:

Stored size: 855 Bytes

Contents

# frozen_string_literal: true

require_relative 'section/function_evaluator'

module Checkoff
  module SelectorClasses
    # Section selector classes
    module Section
      # :ends_with_milestone function
      class EndsWithMilestoneFunctionEvaluator < FunctionEvaluator
        FUNCTION_NAME = :ends_with_milestone

        def matches?
          fn?(selector, FUNCTION_NAME)
        end

        # @param section [Asana::Resources::Section]
        #
        # @sg-ignore
        # @return [Boolean]
        def evaluate(section)
          tasks = client.tasks.get_tasks(section: section.gid,
                                         per_page: 100,
                                         options: { fields: ['resource_subtype'] })
          # @sg-ignore
          tasks.last&.resource_subtype == 'milestone'
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
checkoff-0.117.0 lib/checkoff/internal/selector_classes/section.rb
checkoff-0.116.0 lib/checkoff/internal/selector_classes/section.rb
checkoff-0.115.0 lib/checkoff/internal/selector_classes/section.rb
checkoff-0.114.0 lib/checkoff/internal/selector_classes/section.rb
checkoff-0.113.0 lib/checkoff/internal/selector_classes/section.rb
checkoff-0.112.0 lib/checkoff/internal/selector_classes/section.rb
checkoff-0.111.0 lib/checkoff/internal/selector_classes/section.rb
checkoff-0.110.0 lib/checkoff/internal/selector_classes/section.rb