Class: Hanami::Extensions::Operation::SliceConfiguredDBOperation Private

Inherits:
Module
  • Object
show all
Defined in:
lib/hanami/extensions/operation/slice_configured_db_operation.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Extends operations to support the database.

Add an initializer accepting a ‘rom:` dependency, which is supplied automatically from the `“db.rom”` component in the operation’s slice.

Since:

  • 2.2.0

Defined Under Namespace

Modules: InstanceMethods Classes: SliceInstanceMethods

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(slice) ⇒ SliceConfiguredDBOperation

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of SliceConfiguredDBOperation.

Since:

  • 2.2.0



15
16
17
18
# File 'lib/hanami/extensions/operation/slice_configured_db_operation.rb', line 15

def initialize(slice)
  super()
  @slice = slice
end

Instance Attribute Details

#sliceObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 2.2.0



13
14
15
# File 'lib/hanami/extensions/operation/slice_configured_db_operation.rb', line 13

def slice
  @slice
end

Instance Method Details

#extended(operation_class) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 2.2.0



20
21
22
23
24
25
26
27
# File 'lib/hanami/extensions/operation/slice_configured_db_operation.rb', line 20

def extended(operation_class)
  require "dry/operation/extensions/rom"
  operation_class.include Dry::Operation::Extensions::ROM

  operation_class.include InstanceMethods
  operation_class.include SliceInstanceMethods.new(slice)
  define_new
end

#inspectObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 2.2.0



29
30
31
# File 'lib/hanami/extensions/operation/slice_configured_db_operation.rb', line 29

def inspect
  "#<#{self.class.name}[#{slice.name}>"
end