Class: Checkoff::SelectorClasses::Task::InProjectNamedPFunctionEvaluator

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

Overview

:in_project_named? function

Instance Attribute Summary

Attributes inherited from FunctionEvaluator

#custom_fields, #tasks, #timelines

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, project_name) ⇒ Boolean

@sg-ignore

Parameters:

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

Returns:

  • (Boolean)


93
94
95
96
97
98
99
# File 'lib/checkoff/internal/selector_classes/task.rb', line 93

def evaluate(task, project_name)
  project_names = task.memberships.map do |membership|
    m = T.cast(membership, T::Hash[String, T.untyped])
    T.cast(m.fetch('project'), T::Hash[String, T.untyped]).fetch('name')
  end
  T.cast(project_names.include?(project_name), T::Boolean)
end

#evaluate_arg?(_index) ⇒ Boolean

Parameters:

  • _index (Integer)

Returns:

  • (Boolean)


85
86
87
# File 'lib/checkoff/internal/selector_classes/task.rb', line 85

def evaluate_arg?(_index)
  false
end

#matches?Boolean

Returns:

  • (Boolean)


80
81
82
# File 'lib/checkoff/internal/selector_classes/task.rb', line 80

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