Sha256: 4fe451908115adf1a5d05a7edab786e70ae510a2d60f38c76322d95eb1756c87

Contents?: true

Size: 543 Bytes

Versions: 5

Compression:

Stored size: 543 Bytes

Contents

# frozen_string_literal: true

module LedgerSync
  module Adaptors
    module Mixins
      module InferAdaptorClassMixin
        module ClassMethods
          def inferred_adaptor_class
            @inferred_adaptor_class ||= begin
              parts = name.split('::')
              LedgerSync::Adaptors.const_get(
                parts[parts.index('Adaptors') + 1]
              )::Adaptor
            end
          end
        end

        def self.included(base)
          base.extend ClassMethods
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ledger_sync-1.3.5 lib/ledger_sync/adaptors/mixins/infer_adaptor_class_mixin.rb
ledger_sync-1.3.4 lib/ledger_sync/adaptors/mixins/infer_adaptor_class_mixin.rb
ledger_sync-1.3.3 lib/ledger_sync/adaptors/mixins/infer_adaptor_class_mixin.rb
ledger_sync-1.3.2 lib/ledger_sync/adaptors/mixins/infer_adaptor_class_mixin.rb
ledger_sync-1.3.1 lib/ledger_sync/adaptors/mixins/infer_adaptor_class_mixin.rb