Class: Rivulet::Operation

Inherits:
Dry::Operation
  • Object
show all
Defined in:
lib/rivulet/operation.rb

Class Method Summary collapse

Class Method Details

.container_class_pathObject



3
4
5
6
7
8
9
10
# File 'lib/rivulet/operation.rb', line 3

def self.container_class_path
  self
    .name
    .split('::')
    .then { |path| path[0...path.index('Operations')] }
    .push('Container')
    .inject(Object) { |mod, name| mod.const_get(name) }
end

.inherited(subclass) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/rivulet/operation.rb', line 12

def self.inherited(subclass)
  super

  subclass.prepend(Rivulet::Telemetry::TimingWrapper)
  subclass.const_set(
    :Import, Dry::AutoInject(subclass.container_class_path)
  )
end