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

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

Overview

:section_name_starts_with? function

Instance Method Summary collapse

Methods inherited from FunctionEvaluator

#initialize

Methods included from Logging

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

Constructor Details

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

Instance Method Details

#evaluate(task, section_name_prefix) ⇒ Boolean

@sg-ignore

Parameters:

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

Returns:

  • (Boolean)


50
51
52
53
54
55
# File 'lib/checkoff/internal/selector_classes/task.rb', line 50

def evaluate(task, section_name_prefix)
  task_data = @tasks.task_to_h(task)
  task_data.fetch('unwrapped').fetch('membership_by_section_name').keys.any? do |section_name|
    section_name.start_with? section_name_prefix
  end
end

#evaluate_arg?(_index) ⇒ Boolean

Parameters:

  • _index (Integer)

Returns:

  • (Boolean)


42
43
44
# File 'lib/checkoff/internal/selector_classes/task.rb', line 42

def evaluate_arg?(_index)
  false
end

#matches?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/checkoff/internal/selector_classes/task.rb', line 37

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