Class: ESA::ContextProviders::AccountableContextProvider

Inherits:
ESA::ContextProvider show all
Defined in:
lib/esa/context_providers/accountable_context_provider.rb

Class Method Summary collapse

Methods inherited from ESA::ContextProvider

check_subcontexts, contained_subcontexts, existing_subcontexts

Class Method Details

.contained_ids(context, options = {}) ⇒ Object



12
13
14
# File 'lib/esa/context_providers/accountable_context_provider.rb', line 12

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

.context_id(context, options = {}) ⇒ Object



8
9
10
# File 'lib/esa/context_providers/accountable_context_provider.rb', line 8

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

.instantiate(parent, namespace, id, options = {}) ⇒ Object



16
17
18
19
# File 'lib/esa/context_providers/accountable_context_provider.rb', line 16

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

.provided_typesObject



4
5
6
# File 'lib/esa/context_providers/accountable_context_provider.rb', line 4

def self.provided_types
  ["ESA::Contexts::AccountableContext"]
end