Class: Checkoff::SelectorClasses::Task::SectionNameStartsWithPFunctionEvaluator

Inherits:
FunctionEvaluator show all
Defined in:
lib/checkoff/internal/selector_classes/task.rb,
sig/checkoff.rbs

Overview

:section_name_starts_with? function

Instance Attribute Summary

Attributes inherited from FunctionEvaluator

#custom_fields, #selector, #tasks, #timelines

Instance Method Summary collapse

Methods inherited from FunctionEvaluator

#initialize

Methods inherited from FunctionEvaluator

#debug, #error, #finer, #fn?, #info, #initialize, #log_level, #logger, #warn

Methods included from Logging

#debug, #error, #finer, #info, #log_level, #logger, #warn

Constructor Details

This class inherits a constructor from Checkoff::SelectorClasses::Task::FunctionEvaluator

Instance Method Details

#evaluate(task, section_name_prefix) ⇒ Boolean

sord warn - Asana::Resources::Task wasn't able to be resolved to a constant in this project @param task

@param section_name_prefix

Parameters:

  • task (Asana::Resources::Task)
  • section_name_prefix (String)

Returns:

  • (Boolean)


52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/checkoff/internal/selector_classes/task.rb', line 52

def evaluate(task, section_name_prefix)
  # @type [Hash{'unwrapped' => Hash}]
  task_data = tasks.task_to_h(task)
  # @type [Hash{'membership_by_section_name' => Hash}]
  # @sg-ignore Hash#fetch generic<X> leak on rbs >= 4.1.0, fix in progress upstream
  # https://github.com/castwide/solargraph/pull/1228
  unwrapped = task_data.fetch('unwrapped')
  # @type [Array]
  # @sg-ignore Hash#fetch generic<X> leak on rbs >= 4.1.0, fix in progress upstream
  # https://github.com/castwide/solargraph/pull/1228
  section_names = unwrapped.fetch('membership_by_section_name').keys
  section_names.any? do |section_name|
    String(section_name).start_with?(section_name_prefix)
  end
end

#evaluate_arg?(_index) ⇒ Boolean

@param _index

Parameters:

  • _index (Integer)

Returns:

  • (Boolean)


45
46
47
# File 'lib/checkoff/internal/selector_classes/task.rb', line 45

def evaluate_arg?(_index)
  false
end

#matches?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/checkoff/internal/selector_classes/task.rb', line 40

def matches?
  fn?(selector, :section_name_starts_with?)
end