Class: Checkoff::SelectorClasses::Task::InSectionNamedPFunctionEvaluator

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

Overview

:in_section_named? 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) ⇒ Boolean

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

@param section_name

Parameters:

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

Returns:

  • (Boolean)


83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/checkoff/internal/selector_classes/task.rb', line 83

def evaluate(task, section_name)
  # @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?(section_name)
end

#evaluate_arg?(_index) ⇒ Boolean

@param _index

Parameters:

  • _index (Integer)

Returns:

  • (Boolean)


76
77
78
# File 'lib/checkoff/internal/selector_classes/task.rb', line 76

def evaluate_arg?(_index)
  false
end

#matches?Boolean

Returns:

  • (Boolean)


71
72
73
# File 'lib/checkoff/internal/selector_classes/task.rb', line 71

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