Class: Cortex::ExecuteContentItemStateChangeOperation

Inherits:
Object
  • Object
show all
Includes:
Dry::Transaction::Operation
Defined in:
app/operations/cortex/execute_content_item_state_change_operation.rb

Instance Method Summary collapse

Instance Method Details

#call(input, state:) ⇒ Object



7
8
9
10
11
12
13
14
# File 'app/operations/cortex/execute_content_item_state_change_operation.rb', line 7

def call(input, state:)
  if state && input.can_transition?(state)
    state_method = "#{state}!"
    input.send(state_method)
  end

  Success(input)
end