Sha256: e121f84e9cd670127b99a9f389c090df3a1771865082a7487052f6aa36542e75

Contents?: true

Size: 606 Bytes

Versions: 3

Compression:

Stored size: 606 Bytes

Contents

# frozen_string_literal: true

require_relative 'infer_config_mixin'

module LedgerSync
  module Ledgers
    module Mixins
      module InferResourceClassMixin
        module ClassMethods
          def inferred_resource_class
            @inferred_resource_class ||= begin
              base_module = inferred_config.base_module

              base_module.const_get(name.split(base_module.name).last.split('::')[1])
            end
          end
        end

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ledger_sync-1.5.2 lib/ledger_sync/ledgers/mixins/infer_resource_class_mixin.rb
ledger_sync-1.5.1 lib/ledger_sync/ledgers/mixins/infer_resource_class_mixin.rb
ledger_sync-1.5.0 lib/ledger_sync/ledgers/mixins/infer_resource_class_mixin.rb