Class: JobWorkflow::TaskCallable

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

Defined Under Namespace

Classes: AlreadyCalledError, NotCalledError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize { ... } ⇒ TaskCallable

: () { () -> void } -> void

Yields:

Yield Returns:

  • (void)


20
21
22
23
# File 'lib/job_workflow/task_callable.rb', line 20

def initialize(&block)
  @block = block #: () -> void
  @called = false #: bool
end

Instance Attribute Details

#blockObject (readonly)

Signature:

  • () -> void

Returns:

  • (Object)


40
41
42
# File 'lib/job_workflow/task_callable.rb', line 40

def block
  @block
end

#calledBoolean

Signature:

  • bool

Returns:

  • (Boolean)


41
42
43
# File 'lib/job_workflow/task_callable.rb', line 41

def called
  @called
end

Instance Method Details

#callvoid

This method returns an undefined value.

: () -> void



26
27
28
29
30
31
# File 'lib/job_workflow/task_callable.rb', line 26

def call
  raise AlreadyCalledError if called

  self.called = true
  block.call
end

#called?Boolean

: () -> bool

Returns:

  • (Boolean)


34
35
36
# File 'lib/job_workflow/task_callable.rb', line 34

def called?
  called
end