Sha256: e1b6c7f1cf7c2ea8fc74cfdd211c515d693a08744d95e883e9ed7eca785dab54

Contents?: true

Size: 642 Bytes

Versions: 4

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.pluck(:accountable_type).uniq
      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

4 entries across 4 versions & 1 rubygems

Version Path
event_sourced_accounting-0.1.4 lib/esa/context_providers/accountable_type_context_provider.rb
event_sourced_accounting-0.1.3 lib/esa/context_providers/accountable_type_context_provider.rb
event_sourced_accounting-0.1.1 lib/esa/context_providers/accountable_type_context_provider.rb
event_sourced_accounting-0.1.0 app/models/esa/context_providers/accountable_type_context_provider.rb