Sha256: 91fd857049433da544e80378180706921321577fdd8bd66d7b1533bfde9fdcd4
Contents?: true
Size: 880 Bytes
Versions: 1
Compression:
Stored size: 880 Bytes
Contents
module Transflow class TransactionFailedError < StandardError attr_reader :transaction attr_reader :original_error def initialize(transaction, original_error) @transaction = transaction @original_error = original_error super("#{transaction} failed") set_backtrace(original_error.backtrace) end end class Transaction attr_reader :handler attr_reader :steps def initialize(steps, handler) @steps = steps @handler = handler end def subscribe(listeners) listeners.each { |step, listener| steps[step].subscribe(listener) } end def call(*args) handler.call(*args) rescue Transproc::MalformedInputError => err raise TransactionFailedError.new(self, err) end alias_method :[], :call def to_s "Transaction(#{steps.keys.join(' => ')})" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
transflow-0.0.2 | lib/transflow/transaction.rb |