Sha256: bcbd4257de2bd8161c1ff55d2f06766cbd01a0432bd6353a337fa7b9e5037a01

Contents?: true

Size: 495 Bytes

Versions: 5

Compression:

Stored size: 495 Bytes

Contents

# frozen_string_literal: true

module LedgerSync
  module Adaptors
    module Mixins
      module InferResourceClassMixin
        module ClassMethods
          def inferred_resource_class
            @inferred_resource_class ||= begin
              parts = name.split('::')
              LedgerSync.const_get(parts[parts.index('Adaptors') + 2])
            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_resource_class_mixin.rb
ledger_sync-1.3.4 lib/ledger_sync/adaptors/mixins/infer_resource_class_mixin.rb
ledger_sync-1.3.3 lib/ledger_sync/adaptors/mixins/infer_resource_class_mixin.rb
ledger_sync-1.3.2 lib/ledger_sync/adaptors/mixins/infer_resource_class_mixin.rb
ledger_sync-1.3.1 lib/ledger_sync/adaptors/mixins/infer_resource_class_mixin.rb