Sha256: f68027cb8e18923f183047de8122e8264f1b4caee153e693fdf52e4dadf1a096

Contents?: true

Size: 595 Bytes

Versions: 4

Compression:

Stored size: 595 Bytes

Contents

# frozen_string_literal: true

require_relative 'infer_client_mixin'

module LedgerSync
  module Ledgers
    module Mixins
      module InferResourceClassMixin
        module ClassMethods
          def inferred_resource_class
            @inferred_resource_class ||= begin
              parts = name.split('::')
              inferred_client_class.base_module.const_get(parts[parts.index('Ledgers') + 2])
            end
          end
        end

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ledger_sync-1.4.4 lib/ledger_sync/ledgers/mixins/infer_resource_class_mixin.rb
ledger_sync-1.4.2 lib/ledger_sync/ledgers/mixins/infer_resource_class_mixin.rb
ledger_sync-1.4.1 lib/ledger_sync/ledgers/mixins/infer_resource_class_mixin.rb
ledger_sync-1.4.0 lib/ledger_sync/ledgers/mixins/infer_resource_class_mixin.rb