Class: JobWorkflow::Schedule

Inherits:
Object
  • Object
show all
Defined in:
lib/job_workflow/schedule.rb,
sig/generated/job_workflow/schedule.rbs

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(expression:, class_name:, key: nil, queue: nil, priority: nil, args: {}, description: nil) ⇒ Schedule

rubocop:disable Metrics/ParameterLists : ( expression: String, class_name: String, ?key: (String | Symbol)?, ?queue: String?, ?priority: Integer?, ?args: Hash[Symbol, untyped], ?description: String? ) -> void

Parameters:

  • expression: (String)
  • class_name: (String)
  • key: (String, Symbol, nil) (defaults to: nil)
  • queue: (String, nil) (defaults to: nil)
  • priority: (Integer, nil) (defaults to: nil)
  • args: (Hash[Symbol, untyped]) (defaults to: {})
  • description: (String, nil) (defaults to: nil)


23
24
25
26
27
28
29
30
31
# File 'lib/job_workflow/schedule.rb', line 23

def initialize(expression:, class_name:, key: nil, queue: nil, priority: nil, args: {}, description: nil)
  @expression = expression #: String
  @class_name = class_name #: String
  @key = (key || class_name).to_sym #: Symbol
  @queue = queue #: String?
  @priority = priority #: Integer?
  @args = args #: Hash[Symbol, untyped]
  @description = description #: String?
end

Instance Attribute Details

#argsHash[Symbol, untyped] (readonly)

Signature:

  • Hash[Symbol, untyped]

Returns:

  • (Hash[Symbol, untyped])


10
11
12
# File 'lib/job_workflow/schedule.rb', line 10

def args
  @args
end

#class_nameString (readonly)

Signature:

  • String

Returns:

  • (String)


6
7
8
# File 'lib/job_workflow/schedule.rb', line 6

def class_name
  @class_name
end

#descriptionString? (readonly)

Signature:

  • String?

Returns:

  • (String, nil)


11
12
13
# File 'lib/job_workflow/schedule.rb', line 11

def description
  @description
end

#expressionString (readonly)

Signature:

  • String

Returns:

  • (String)


7
8
9
# File 'lib/job_workflow/schedule.rb', line 7

def expression
  @expression
end

#keySymbol (readonly)

Signature:

  • Symbol

Returns:

  • (Symbol)


5
6
7
# File 'lib/job_workflow/schedule.rb', line 5

def key
  @key
end

#priorityInteger? (readonly)

Signature:

  • Integer?

Returns:

  • (Integer, nil)


9
10
11
# File 'lib/job_workflow/schedule.rb', line 9

def priority
  @priority
end

#queueString? (readonly)

Signature:

  • String?

Returns:

  • (String, nil)


8
9
10
# File 'lib/job_workflow/schedule.rb', line 8

def queue
  @queue
end

Instance Method Details

#to_configHash[Symbol, untyped]

: () -> Hash[Symbol, untyped]

Returns:

  • (Hash[Symbol, untyped])


35
36
37
38
39
40
41
42
43
44
# File 'lib/job_workflow/schedule.rb', line 35

def to_config
  {
    class: class_name,
    schedule: expression,
    queue: queue,
    priority: priority,
    args: args.empty? ? nil : [args],
    description: description
  }.compact
end