Class: Hyrax::Workflow::MethodGenerator

Inherits:
Object
  • Object
show all
Defined in:
app/services/hyrax/workflow/method_generator.rb

Overview

Responsible for writing the database records for the given :action and :method list.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(action:, list:) ⇒ MethodGenerator

Returns a new instance of MethodGenerator.

Parameters:



16
17
18
19
# File 'app/services/hyrax/workflow/method_generator.rb', line 16

def initialize(action:, list:)
  @action = action
  @list = list
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



21
22
23
# File 'app/services/hyrax/workflow/method_generator.rb', line 21

def action
  @action
end

#listObject (readonly)

Returns the value of attribute list.



21
22
23
# File 'app/services/hyrax/workflow/method_generator.rb', line 21

def list
  @list
end

Class Method Details

.call(action:, list:) ⇒ Object

Parameters:



10
11
12
# File 'app/services/hyrax/workflow/method_generator.rb', line 10

def self.call(action:, list:)
  new(action: action, list: list).call
end

Instance Method Details

#callObject



23
24
25
26
27
28
29
# File 'app/services/hyrax/workflow/method_generator.rb', line 23

def call
  if list.size < action.triggered_methods.count
    replace_list
  else
    update_list
  end
end