Class: Tasker::HashIdentityStrategy

Inherits:
IdentityStrategy show all
Defined in:
lib/tasker/identity_strategy.rb

Overview

Strategy that uses SHA256 hash of task identity options

This strategy is useful when you want identical tasks (with the same options/parameters) to have the same identity hash.

Instance Method Summary collapse

Instance Method Details

#generate_identity_hash(_task, task_options) ⇒ String

Generate a deterministic identity hash based on task options

Parameters:

  • _task (Tasker::Task)

    The task to generate an identity for

  • task_options (Hash)

    Task options to hash for identity

Returns:

  • (String)

    A SHA256 hash of the task options



34
35
36
# File 'lib/tasker/identity_strategy.rb', line 34

def generate_identity_hash(_task, task_options)
  Digest::SHA256.hexdigest(task_options.to_json)
end