Class: Riveter::Service::Base

Inherits:
Object
  • Object
show all
Includes:
Riveter::Service
Defined in:
lib/riveter/service.rb

Overview

helper class

Class Method Summary collapse

Methods included from Riveter::Service

#perform

Class Method Details

.inherited(klass) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/riveter/service.rb', line 27

def inherited(klass)
  #
  # attempt to get the name of the command
  # from the derived classes name and register
  # it as the service handler for that command
  #
  # e.g. CreatePortfolioCommand ==> CreatePortfolioService
  #
  command_type = klass.name.gsub(/Service$/, 'Command').constantize rescue nil
  register_type klass, command_type unless command_type.nil?
end