Sha256: 7ebe162049394f4ef612d8700d5c9fa3f660660427aba601d509e8c01a0e1541

Contents?: true

Size: 642 Bytes

Versions: 5

Compression:

Stored size: 642 Bytes

Contents

module ESA
  module ContextProviders
    class AccountableTypeContextProvider < ESA::ContextProvider
      def self.provided_types
        ["ESA::Contexts::AccountableTypeContext"]
      end

      def self.context_id(context, options = {})
        context.accountable_type
      end

      def self.contained_ids(context, options = {})
        context.transactions.uniq.pluck(:accountable_type)
      end

      def self.instantiate(parent, namespace, id, options = {})
        ESA::Contexts::AccountableTypeContext.new(chart_id: parent.chart_id, parent_id: parent.id, namespace: namespace, accountable_type: id)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
event_sourced_accounting-0.2.6 lib/esa/context_providers/accountable_type_context_provider.rb
event_sourced_accounting-0.2.4 lib/esa/context_providers/accountable_type_context_provider.rb
event_sourced_accounting-0.2.3 lib/esa/context_providers/accountable_type_context_provider.rb
event_sourced_accounting-0.2.2 lib/esa/context_providers/accountable_type_context_provider.rb
event_sourced_accounting-0.1.6 lib/esa/context_providers/accountable_type_context_provider.rb