Class: RiotKit::Services::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/riot_kit/services/base.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.callObject



8
9
10
# File 'lib/riot_kit/services/base.rb', line 8

def self.call(**)
  new(**).call
end

.steps(*names) ⇒ Object



26
27
28
29
30
# File 'lib/riot_kit/services/base.rb', line 26

def steps(*names)
  define_method(:process_steps) do
    names.each { |step_name| send(step_name) }
  end
end

Instance Method Details

#callObject



12
13
14
15
16
17
# File 'lib/riot_kit/services/base.rb', line 12

def call
  process_steps
  Result.success(result_value)
rescue Errors::Base => e
  Result.failure(e)
end