Sha256: d178670b3489575714e24f3d5955685e149d9646690cab5823b43c29fb1a8709

Contents?: true

Size: 767 Bytes

Versions: 5

Compression:

Stored size: 767 Bytes

Contents

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

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

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

      def self.instantiate(parent, namespace, id, options = {})
        accountable_id, accountable_type = id
        ESA::Contexts::AccountableContext.new(chart_id: parent.chart_id, parent_id: parent.id, namespace: namespace, accountable_id: accountable_id, accountable_type: accountable_type)
      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_context_provider.rb
event_sourced_accounting-0.2.4 lib/esa/context_providers/accountable_context_provider.rb
event_sourced_accounting-0.2.3 lib/esa/context_providers/accountable_context_provider.rb
event_sourced_accounting-0.2.2 lib/esa/context_providers/accountable_context_provider.rb
event_sourced_accounting-0.1.6 lib/esa/context_providers/accountable_context_provider.rb