Class: CurationConcerns::Workflow::MethodGenerator

Inherits:
Object
  • Object
show all
Defined in:
app/services/curation_concerns/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:



15
16
17
18
# File 'app/services/curation_concerns/workflow/method_generator.rb', line 15

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

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



20
21
22
# File 'app/services/curation_concerns/workflow/method_generator.rb', line 20

def action
  @action
end

#listObject (readonly)

Returns the value of attribute list.



20
21
22
# File 'app/services/curation_concerns/workflow/method_generator.rb', line 20

def list
  @list
end

Class Method Details

.call(action:, list:) ⇒ Object

Parameters:



9
10
11
# File 'app/services/curation_concerns/workflow/method_generator.rb', line 9

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

Instance Method Details

#callObject



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

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