Sha256: c123d11b616e7906c3ca4dfb787221b7ed055d95c1125e599480a2028a137f74

Contents?: true

Size: 767 Bytes

Versions: 15

Compression:

Stored size: 767 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
              if name.include?('::Operations::')
                base_module.const_get(name.split('::Operations::').first)
              else
                base_module.const_get(name.split(base_module.name).last.split('::')[1])
              end
            end
          end
        end

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

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
ledger_sync-2.6.0 lib/ledger_sync/ledgers/mixins/infer_resource_class_mixin.rb
ledger_sync-2.5.0 lib/ledger_sync/ledgers/mixins/infer_resource_class_mixin.rb
ledger_sync-2.4.4 lib/ledger_sync/ledgers/mixins/infer_resource_class_mixin.rb
ledger_sync-2.3.1 lib/ledger_sync/ledgers/mixins/infer_resource_class_mixin.rb
ledger_sync-2.2.3 lib/ledger_sync/ledgers/mixins/infer_resource_class_mixin.rb
ledger_sync-2.2.1 lib/ledger_sync/ledgers/mixins/infer_resource_class_mixin.rb
ledger_sync-2.2.0 lib/ledger_sync/ledgers/mixins/infer_resource_class_mixin.rb
ledger_sync-2.0.2 lib/ledger_sync/ledgers/mixins/infer_resource_class_mixin.rb
ledger_sync-2.0.1 lib/ledger_sync/ledgers/mixins/infer_resource_class_mixin.rb
ledger_sync-2.0.0 lib/ledger_sync/ledgers/mixins/infer_resource_class_mixin.rb
ledger_sync-2.0.0.pre.1 lib/ledger_sync/ledgers/mixins/infer_resource_class_mixin.rb
ledger_sync-1.8.1 lib/ledger_sync/ledgers/mixins/infer_resource_class_mixin.rb
ledger_sync-1.8.0 lib/ledger_sync/ledgers/mixins/infer_resource_class_mixin.rb
ledger_sync-1.7.0 lib/ledger_sync/ledgers/mixins/infer_resource_class_mixin.rb
ledger_sync-1.6.0 lib/ledger_sync/ledgers/mixins/infer_resource_class_mixin.rb