module DCI::Context::InstanceMethods

Public Instance Methods

call() click to toggle source
# File lib/dci/context.rb, line 44
def call
  raise NotImplementedError.new("implement me")
end
context=(ctx) click to toggle source
# File lib/dci/context.rb, line 36
def context=(ctx)
  Thread.current[:context] = ctx
end
context_events=(ctx_events = []) click to toggle source
# File lib/dci/context.rb, line 40
def context_events=(ctx_events = [])
  Thread.current[:context_events] = Array(ctx_events).compact.flatten
end
perform_in_transaction() click to toggle source
# File lib/dci/context.rb, line 16
def perform_in_transaction
  old_context        = context
  old_context_events = context_events

  self.context        = self
  self.context_events = []

  res = nil

  DCI.configuration.transaction_class.transaction do
    res = call
  end

  route_events!(context_events)
  res
ensure
  self.context        = old_context
  self.context_events = old_context_events
end

Private Instance Methods

init_context_events() click to toggle source
# File lib/dci/context.rb, line 50
def init_context_events
  []
end