Class: Checkoff::SelectorClasses::Common::CustomFieldValueFunctionEvaluator

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

Overview

:custom_field_value function

Constant Summary collapse

FUNCTION_NAME =
:custom_field_value

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::Common::FunctionEvaluator

Instance Method Details

#evaluate(resource, custom_field_name) ⇒ String?

Parameters:

  • resource (Asana::Resources::Task, Asana::Resources::Project)
  • custom_field_name (String)

Returns:

  • (String, nil)


106
107
108
109
110
111
# File 'lib/checkoff/internal/selector_classes/common.rb', line 106

def evaluate(resource, custom_field_name)
  custom_field = @custom_fields.resource_custom_field_by_name(resource, custom_field_name)
  return nil if custom_field.nil?

  custom_field['display_value']
end

#evaluate_arg?(_index) ⇒ Boolean

Parameters:

  • _index (Integer)

Returns:

  • (Boolean)


99
100
101
# File 'lib/checkoff/internal/selector_classes/common.rb', line 99

def evaluate_arg?(_index)
  false
end

#matches?Boolean

Returns:

  • (Boolean)


94
95
96
# File 'lib/checkoff/internal/selector_classes/common.rb', line 94

def matches?
  fn?(selector, FUNCTION_NAME)
end